proteus  1.7.3.dev0
C/C++/Fortran libraries
subsurfaceTransportFunctions.c
Go to the documentation of this file.
1 /* Generated by Cython 0.29.21 */
2 
3 #define PY_SSIZE_T_CLEAN
4 #include "Python.h"
5 #ifndef Py_PYTHON_H
6  #error Python headers needed to compile C extensions, please install development version of Python.
7 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
8  #error Cython requires Python 2.6+ or Python 3.3+.
9 #else
10 #define CYTHON_ABI "0_29_21"
11 #define CYTHON_HEX_VERSION 0x001D15F0
12 #define CYTHON_FUTURE_DIVISION 0
13 #include <stddef.h>
14 #ifndef offsetof
15  #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
16 #endif
17 #if !defined(WIN32) && !defined(MS_WINDOWS)
18  #ifndef __stdcall
19  #define __stdcall
20  #endif
21  #ifndef __cdecl
22  #define __cdecl
23  #endif
24  #ifndef __fastcall
25  #define __fastcall
26  #endif
27 #endif
28 #ifndef DL_IMPORT
29  #define DL_IMPORT(t) t
30 #endif
31 #ifndef DL_EXPORT
32  #define DL_EXPORT(t) t
33 #endif
34 #define __PYX_COMMA ,
35 #ifndef HAVE_LONG_LONG
36  #if PY_VERSION_HEX >= 0x02070000
37  #define HAVE_LONG_LONG
38  #endif
39 #endif
40 #ifndef PY_LONG_LONG
41  #define PY_LONG_LONG LONG_LONG
42 #endif
43 #ifndef Py_HUGE_VAL
44  #define Py_HUGE_VAL HUGE_VAL
45 #endif
46 #ifdef PYPY_VERSION
47  #define CYTHON_COMPILING_IN_PYPY 1
48  #define CYTHON_COMPILING_IN_PYSTON 0
49  #define CYTHON_COMPILING_IN_CPYTHON 0
50  #undef CYTHON_USE_TYPE_SLOTS
51  #define CYTHON_USE_TYPE_SLOTS 0
52  #undef CYTHON_USE_PYTYPE_LOOKUP
53  #define CYTHON_USE_PYTYPE_LOOKUP 0
54  #if PY_VERSION_HEX < 0x03050000
55  #undef CYTHON_USE_ASYNC_SLOTS
56  #define CYTHON_USE_ASYNC_SLOTS 0
57  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
58  #define CYTHON_USE_ASYNC_SLOTS 1
59  #endif
60  #undef CYTHON_USE_PYLIST_INTERNALS
61  #define CYTHON_USE_PYLIST_INTERNALS 0
62  #undef CYTHON_USE_UNICODE_INTERNALS
63  #define CYTHON_USE_UNICODE_INTERNALS 0
64  #undef CYTHON_USE_UNICODE_WRITER
65  #define CYTHON_USE_UNICODE_WRITER 0
66  #undef CYTHON_USE_PYLONG_INTERNALS
67  #define CYTHON_USE_PYLONG_INTERNALS 0
68  #undef CYTHON_AVOID_BORROWED_REFS
69  #define CYTHON_AVOID_BORROWED_REFS 1
70  #undef CYTHON_ASSUME_SAFE_MACROS
71  #define CYTHON_ASSUME_SAFE_MACROS 0
72  #undef CYTHON_UNPACK_METHODS
73  #define CYTHON_UNPACK_METHODS 0
74  #undef CYTHON_FAST_THREAD_STATE
75  #define CYTHON_FAST_THREAD_STATE 0
76  #undef CYTHON_FAST_PYCALL
77  #define CYTHON_FAST_PYCALL 0
78  #undef CYTHON_PEP489_MULTI_PHASE_INIT
79  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
80  #undef CYTHON_USE_TP_FINALIZE
81  #define CYTHON_USE_TP_FINALIZE 0
82  #undef CYTHON_USE_DICT_VERSIONS
83  #define CYTHON_USE_DICT_VERSIONS 0
84  #undef CYTHON_USE_EXC_INFO_STACK
85  #define CYTHON_USE_EXC_INFO_STACK 0
86 #elif defined(PYSTON_VERSION)
87  #define CYTHON_COMPILING_IN_PYPY 0
88  #define CYTHON_COMPILING_IN_PYSTON 1
89  #define CYTHON_COMPILING_IN_CPYTHON 0
90  #ifndef CYTHON_USE_TYPE_SLOTS
91  #define CYTHON_USE_TYPE_SLOTS 1
92  #endif
93  #undef CYTHON_USE_PYTYPE_LOOKUP
94  #define CYTHON_USE_PYTYPE_LOOKUP 0
95  #undef CYTHON_USE_ASYNC_SLOTS
96  #define CYTHON_USE_ASYNC_SLOTS 0
97  #undef CYTHON_USE_PYLIST_INTERNALS
98  #define CYTHON_USE_PYLIST_INTERNALS 0
99  #ifndef CYTHON_USE_UNICODE_INTERNALS
100  #define CYTHON_USE_UNICODE_INTERNALS 1
101  #endif
102  #undef CYTHON_USE_UNICODE_WRITER
103  #define CYTHON_USE_UNICODE_WRITER 0
104  #undef CYTHON_USE_PYLONG_INTERNALS
105  #define CYTHON_USE_PYLONG_INTERNALS 0
106  #ifndef CYTHON_AVOID_BORROWED_REFS
107  #define CYTHON_AVOID_BORROWED_REFS 0
108  #endif
109  #ifndef CYTHON_ASSUME_SAFE_MACROS
110  #define CYTHON_ASSUME_SAFE_MACROS 1
111  #endif
112  #ifndef CYTHON_UNPACK_METHODS
113  #define CYTHON_UNPACK_METHODS 1
114  #endif
115  #undef CYTHON_FAST_THREAD_STATE
116  #define CYTHON_FAST_THREAD_STATE 0
117  #undef CYTHON_FAST_PYCALL
118  #define CYTHON_FAST_PYCALL 0
119  #undef CYTHON_PEP489_MULTI_PHASE_INIT
120  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
121  #undef CYTHON_USE_TP_FINALIZE
122  #define CYTHON_USE_TP_FINALIZE 0
123  #undef CYTHON_USE_DICT_VERSIONS
124  #define CYTHON_USE_DICT_VERSIONS 0
125  #undef CYTHON_USE_EXC_INFO_STACK
126  #define CYTHON_USE_EXC_INFO_STACK 0
127 #else
128  #define CYTHON_COMPILING_IN_PYPY 0
129  #define CYTHON_COMPILING_IN_PYSTON 0
130  #define CYTHON_COMPILING_IN_CPYTHON 1
131  #ifndef CYTHON_USE_TYPE_SLOTS
132  #define CYTHON_USE_TYPE_SLOTS 1
133  #endif
134  #if PY_VERSION_HEX < 0x02070000
135  #undef CYTHON_USE_PYTYPE_LOOKUP
136  #define CYTHON_USE_PYTYPE_LOOKUP 0
137  #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
138  #define CYTHON_USE_PYTYPE_LOOKUP 1
139  #endif
140  #if PY_MAJOR_VERSION < 3
141  #undef CYTHON_USE_ASYNC_SLOTS
142  #define CYTHON_USE_ASYNC_SLOTS 0
143  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
144  #define CYTHON_USE_ASYNC_SLOTS 1
145  #endif
146  #if PY_VERSION_HEX < 0x02070000
147  #undef CYTHON_USE_PYLONG_INTERNALS
148  #define CYTHON_USE_PYLONG_INTERNALS 0
149  #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
150  #define CYTHON_USE_PYLONG_INTERNALS 1
151  #endif
152  #ifndef CYTHON_USE_PYLIST_INTERNALS
153  #define CYTHON_USE_PYLIST_INTERNALS 1
154  #endif
155  #ifndef CYTHON_USE_UNICODE_INTERNALS
156  #define CYTHON_USE_UNICODE_INTERNALS 1
157  #endif
158  #if PY_VERSION_HEX < 0x030300F0
159  #undef CYTHON_USE_UNICODE_WRITER
160  #define CYTHON_USE_UNICODE_WRITER 0
161  #elif !defined(CYTHON_USE_UNICODE_WRITER)
162  #define CYTHON_USE_UNICODE_WRITER 1
163  #endif
164  #ifndef CYTHON_AVOID_BORROWED_REFS
165  #define CYTHON_AVOID_BORROWED_REFS 0
166  #endif
167  #ifndef CYTHON_ASSUME_SAFE_MACROS
168  #define CYTHON_ASSUME_SAFE_MACROS 1
169  #endif
170  #ifndef CYTHON_UNPACK_METHODS
171  #define CYTHON_UNPACK_METHODS 1
172  #endif
173  #ifndef CYTHON_FAST_THREAD_STATE
174  #define CYTHON_FAST_THREAD_STATE 1
175  #endif
176  #ifndef CYTHON_FAST_PYCALL
177  #define CYTHON_FAST_PYCALL 1
178  #endif
179  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
180  #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
181  #endif
182  #ifndef CYTHON_USE_TP_FINALIZE
183  #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
184  #endif
185  #ifndef CYTHON_USE_DICT_VERSIONS
186  #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
187  #endif
188  #ifndef CYTHON_USE_EXC_INFO_STACK
189  #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
190  #endif
191 #endif
192 #if !defined(CYTHON_FAST_PYCCALL)
193 #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
194 #endif
195 #if CYTHON_USE_PYLONG_INTERNALS
196  #include "longintrepr.h"
197  #undef SHIFT
198  #undef BASE
199  #undef MASK
200  #ifdef SIZEOF_VOID_P
201  enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
202  #endif
203 #endif
204 #ifndef __has_attribute
205  #define __has_attribute(x) 0
206 #endif
207 #ifndef __has_cpp_attribute
208  #define __has_cpp_attribute(x) 0
209 #endif
210 #ifndef CYTHON_RESTRICT
211  #if defined(__GNUC__)
212  #define CYTHON_RESTRICT __restrict__
213  #elif defined(_MSC_VER) && _MSC_VER >= 1400
214  #define CYTHON_RESTRICT __restrict
215  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
216  #define CYTHON_RESTRICT restrict
217  #else
218  #define CYTHON_RESTRICT
219  #endif
220 #endif
221 #ifndef CYTHON_UNUSED
222 # if defined(__GNUC__)
223 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
224 # define CYTHON_UNUSED __attribute__ ((__unused__))
225 # else
226 # define CYTHON_UNUSED
227 # endif
228 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
229 # define CYTHON_UNUSED __attribute__ ((__unused__))
230 # else
231 # define CYTHON_UNUSED
232 # endif
233 #endif
234 #ifndef CYTHON_MAYBE_UNUSED_VAR
235 # if defined(__cplusplus)
236  template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
237 # else
238 # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
239 # endif
240 #endif
241 #ifndef CYTHON_NCP_UNUSED
242 # if CYTHON_COMPILING_IN_CPYTHON
243 # define CYTHON_NCP_UNUSED
244 # else
245 # define CYTHON_NCP_UNUSED CYTHON_UNUSED
246 # endif
247 #endif
248 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
249 #ifdef _MSC_VER
250  #ifndef _MSC_STDINT_H_
251  #if _MSC_VER < 1300
252  typedef unsigned char uint8_t;
253  typedef unsigned int uint32_t;
254  #else
255  typedef unsigned __int8 uint8_t;
256  typedef unsigned __int32 uint32_t;
257  #endif
258  #endif
259 #else
260  #include <stdint.h>
261 #endif
262 #ifndef CYTHON_FALLTHROUGH
263  #if defined(__cplusplus) && __cplusplus >= 201103L
264  #if __has_cpp_attribute(fallthrough)
265  #define CYTHON_FALLTHROUGH [[fallthrough]]
266  #elif __has_cpp_attribute(clang::fallthrough)
267  #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
268  #elif __has_cpp_attribute(gnu::fallthrough)
269  #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
270  #endif
271  #endif
272  #ifndef CYTHON_FALLTHROUGH
273  #if __has_attribute(fallthrough)
274  #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
275  #else
276  #define CYTHON_FALLTHROUGH
277  #endif
278  #endif
279  #if defined(__clang__ ) && defined(__apple_build_version__)
280  #if __apple_build_version__ < 7000000
281  #undef CYTHON_FALLTHROUGH
282  #define CYTHON_FALLTHROUGH
283  #endif
284  #endif
285 #endif
286 
287 #ifndef CYTHON_INLINE
288  #if defined(__clang__)
289  #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
290  #elif defined(__GNUC__)
291  #define CYTHON_INLINE __inline__
292  #elif defined(_MSC_VER)
293  #define CYTHON_INLINE __inline
294  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
295  #define CYTHON_INLINE inline
296  #else
297  #define CYTHON_INLINE
298  #endif
299 #endif
300 
301 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
302  #define Py_OptimizeFlag 0
303 #endif
304 #define __PYX_BUILD_PY_SSIZE_T "n"
305 #define CYTHON_FORMAT_SSIZE_T "z"
306 #if PY_MAJOR_VERSION < 3
307  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
308  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
309  PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
310  #define __Pyx_DefaultClassType PyClass_Type
311 #else
312  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
313 #if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
314  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
315  PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
316 #else
317  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
318  PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
319 #endif
320  #define __Pyx_DefaultClassType PyType_Type
321 #endif
322 #ifndef Py_TPFLAGS_CHECKTYPES
323  #define Py_TPFLAGS_CHECKTYPES 0
324 #endif
325 #ifndef Py_TPFLAGS_HAVE_INDEX
326  #define Py_TPFLAGS_HAVE_INDEX 0
327 #endif
328 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
329  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
330 #endif
331 #ifndef Py_TPFLAGS_HAVE_FINALIZE
332  #define Py_TPFLAGS_HAVE_FINALIZE 0
333 #endif
334 #ifndef METH_STACKLESS
335  #define METH_STACKLESS 0
336 #endif
337 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
338  #ifndef METH_FASTCALL
339  #define METH_FASTCALL 0x80
340  #endif
341  typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
342  typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
343  Py_ssize_t nargs, PyObject *kwnames);
344 #else
345  #define __Pyx_PyCFunctionFast _PyCFunctionFast
346  #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
347 #endif
348 #if CYTHON_FAST_PYCCALL
349 #define __Pyx_PyFastCFunction_Check(func)\
350  ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
351 #else
352 #define __Pyx_PyFastCFunction_Check(func) 0
353 #endif
354 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
355  #define PyObject_Malloc(s) PyMem_Malloc(s)
356  #define PyObject_Free(p) PyMem_Free(p)
357  #define PyObject_Realloc(p) PyMem_Realloc(p)
358 #endif
359 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
360  #define PyMem_RawMalloc(n) PyMem_Malloc(n)
361  #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n)
362  #define PyMem_RawFree(p) PyMem_Free(p)
363 #endif
364 #if CYTHON_COMPILING_IN_PYSTON
365  #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
366  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
367 #else
368  #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
369  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
370 #endif
371 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
372  #define __Pyx_PyThreadState_Current PyThreadState_GET()
373 #elif PY_VERSION_HEX >= 0x03060000
374  #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
375 #elif PY_VERSION_HEX >= 0x03000000
376  #define __Pyx_PyThreadState_Current PyThreadState_GET()
377 #else
378  #define __Pyx_PyThreadState_Current _PyThreadState_Current
379 #endif
380 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
381 #include "pythread.h"
382 #define Py_tss_NEEDS_INIT 0
383 typedef int Py_tss_t;
384 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
385  *key = PyThread_create_key();
386  return 0;
387 }
388 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
389  Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
390  *key = Py_tss_NEEDS_INIT;
391  return key;
392 }
393 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
394  PyObject_Free(key);
395 }
396 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
397  return *key != Py_tss_NEEDS_INIT;
398 }
399 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
400  PyThread_delete_key(*key);
401  *key = Py_tss_NEEDS_INIT;
402 }
403 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
404  return PyThread_set_key_value(*key, value);
405 }
406 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
407  return PyThread_get_key_value(*key);
408 }
409 #endif
410 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
411 #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
412 #else
413 #define __Pyx_PyDict_NewPresized(n) PyDict_New()
414 #endif
415 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
416  #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
417  #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
418 #else
419  #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
420  #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
421 #endif
422 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
423 #define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
424 #else
425 #define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name)
426 #endif
427 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
428  #define CYTHON_PEP393_ENABLED 1
429  #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
430  0 : _PyUnicode_Ready((PyObject *)(op)))
431  #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
432  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
433  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
434  #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
435  #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
436  #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
437  #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
438  #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
439  #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
440  #else
441  #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u))
442  #endif
443 #else
444  #define CYTHON_PEP393_ENABLED 0
445  #define PyUnicode_1BYTE_KIND 1
446  #define PyUnicode_2BYTE_KIND 2
447  #define PyUnicode_4BYTE_KIND 4
448  #define __Pyx_PyUnicode_READY(op) (0)
449  #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
450  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
451  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
452  #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
453  #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
454  #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
455  #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
456  #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
457 #endif
458 #if CYTHON_COMPILING_IN_PYPY
459  #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
460  #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
461 #else
462  #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
463  #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
464  PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
465 #endif
466 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
467  #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
468 #endif
469 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
470  #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
471 #endif
472 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
473  #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
474 #endif
475 #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
476 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
477 #if PY_MAJOR_VERSION >= 3
478  #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
479 #else
480  #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
481 #endif
482 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
483  #define PyObject_ASCII(o) PyObject_Repr(o)
484 #endif
485 #if PY_MAJOR_VERSION >= 3
486  #define PyBaseString_Type PyUnicode_Type
487  #define PyStringObject PyUnicodeObject
488  #define PyString_Type PyUnicode_Type
489  #define PyString_Check PyUnicode_Check
490  #define PyString_CheckExact PyUnicode_CheckExact
491 #ifndef PyObject_Unicode
492  #define PyObject_Unicode PyObject_Str
493 #endif
494 #endif
495 #if PY_MAJOR_VERSION >= 3
496  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
497  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
498 #else
499  #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
500  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
501 #endif
502 #ifndef PySet_CheckExact
503  #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
504 #endif
505 #if PY_VERSION_HEX >= 0x030900A4
506  #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
507  #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
508 #else
509  #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
510  #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
511 #endif
512 #if CYTHON_ASSUME_SAFE_MACROS
513  #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
514 #else
515  #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
516 #endif
517 #if PY_MAJOR_VERSION >= 3
518  #define PyIntObject PyLongObject
519  #define PyInt_Type PyLong_Type
520  #define PyInt_Check(op) PyLong_Check(op)
521  #define PyInt_CheckExact(op) PyLong_CheckExact(op)
522  #define PyInt_FromString PyLong_FromString
523  #define PyInt_FromUnicode PyLong_FromUnicode
524  #define PyInt_FromLong PyLong_FromLong
525  #define PyInt_FromSize_t PyLong_FromSize_t
526  #define PyInt_FromSsize_t PyLong_FromSsize_t
527  #define PyInt_AsLong PyLong_AsLong
528  #define PyInt_AS_LONG PyLong_AS_LONG
529  #define PyInt_AsSsize_t PyLong_AsSsize_t
530  #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
531  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
532  #define PyNumber_Int PyNumber_Long
533 #endif
534 #if PY_MAJOR_VERSION >= 3
535  #define PyBoolObject PyLongObject
536 #endif
537 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
538  #ifndef PyUnicode_InternFromString
539  #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
540  #endif
541 #endif
542 #if PY_VERSION_HEX < 0x030200A4
543  typedef long Py_hash_t;
544  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
545  #define __Pyx_PyInt_AsHash_t PyInt_AsLong
546 #else
547  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
548  #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
549 #endif
550 #if PY_MAJOR_VERSION >= 3
551  #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
552 #else
553  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
554 #endif
555 #if CYTHON_USE_ASYNC_SLOTS
556  #if PY_VERSION_HEX >= 0x030500B1
557  #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
558  #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
559  #else
560  #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
561  #endif
562 #else
563  #define __Pyx_PyType_AsAsync(obj) NULL
564 #endif
565 #ifndef __Pyx_PyAsyncMethodsStruct
566  typedef struct {
567  unaryfunc am_await;
568  unaryfunc am_aiter;
569  unaryfunc am_anext;
570  } __Pyx_PyAsyncMethodsStruct;
571 #endif
572 
573 #if defined(WIN32) || defined(MS_WINDOWS)
574  #define _USE_MATH_DEFINES
575 #endif
576 #include <math.h>
577 #ifdef NAN
578 #define __PYX_NAN() ((float) NAN)
579 #else
580 static CYTHON_INLINE float __PYX_NAN() {
581  float value;
582  memset(&value, 0xFF, sizeof(value));
583  return value;
584 }
585 #endif
586 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
587 #define __Pyx_truncl trunc
588 #else
589 #define __Pyx_truncl truncl
590 #endif
591 
592 #define __PYX_MARK_ERR_POS(f_index, lineno) \
593  { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
594 #define __PYX_ERR(f_index, lineno, Ln_error) \
595  { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
596 
597 #ifndef __PYX_EXTERN_C
598  #ifdef __cplusplus
599  #define __PYX_EXTERN_C extern "C"
600  #else
601  #define __PYX_EXTERN_C extern
602  #endif
603 #endif
604 
605 #define __PYX_HAVE__subsurfaceTransportFunctions
606 #define __PYX_HAVE_API__subsurfaceTransportFunctions
607 /* Early includes */
608 #include <string.h>
609 #include <stdio.h>
610 #include "numpy/arrayobject.h"
611 #include "numpy/ufuncobject.h"
612 
613  /* NumPy API declarations from "numpy/__init__.pxd" */
614 
615 #include "math.h"
616 #ifdef _OPENMP
617 #include <omp.h>
618 #endif /* _OPENMP */
619 
620 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
621 #define CYTHON_WITHOUT_ASSERTIONS
622 #endif
623 
624 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
625  const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
626 
627 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
628 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
629 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
630 #define __PYX_DEFAULT_STRING_ENCODING ""
631 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
632 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
633 #define __Pyx_uchar_cast(c) ((unsigned char)c)
634 #define __Pyx_long_cast(x) ((long)x)
635 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
636  (sizeof(type) < sizeof(Py_ssize_t)) ||\
637  (sizeof(type) > sizeof(Py_ssize_t) &&\
638  likely(v < (type)PY_SSIZE_T_MAX ||\
639  v == (type)PY_SSIZE_T_MAX) &&\
640  (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
641  v == (type)PY_SSIZE_T_MIN))) ||\
642  (sizeof(type) == sizeof(Py_ssize_t) &&\
643  (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
644  v == (type)PY_SSIZE_T_MAX))) )
645 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
646  return (size_t) i < (size_t) limit;
647 }
648 #if defined (__cplusplus) && __cplusplus >= 201103L
649  #include <cstdlib>
650  #define __Pyx_sst_abs(value) std::abs(value)
651 #elif SIZEOF_INT >= SIZEOF_SIZE_T
652  #define __Pyx_sst_abs(value) abs(value)
653 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
654  #define __Pyx_sst_abs(value) labs(value)
655 #elif defined (_MSC_VER)
656  #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
657 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
658  #define __Pyx_sst_abs(value) llabs(value)
659 #elif defined (__GNUC__)
660  #define __Pyx_sst_abs(value) __builtin_llabs(value)
661 #else
662  #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
663 #endif
664 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
665 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
666 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
667 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
668 #define __Pyx_PyBytes_FromString PyBytes_FromString
669 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
670 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
671 #if PY_MAJOR_VERSION < 3
672  #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
673  #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
674 #else
675  #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
676  #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
677 #endif
678 #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
679 #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
680 #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
681 #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
682 #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
683 #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
684 #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s))
685 #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
686 #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
687 #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
688 #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
689 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
690 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
691 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
692 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
693 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
694 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
695  const Py_UNICODE *u_end = u;
696  while (*u_end++) ;
697  return (size_t)(u_end - u - 1);
698 }
699 #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
700 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
701 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
702 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
703 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
704 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
705 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
706 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
707 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
708 #define __Pyx_PySequence_Tuple(obj)\
709  (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
710 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
711 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
712 #if CYTHON_ASSUME_SAFE_MACROS
713 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
714 #else
715 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
716 #endif
717 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
718 #if PY_MAJOR_VERSION >= 3
719 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
720 #else
721 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
722 #endif
723 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
724 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
725 static int __Pyx_sys_getdefaultencoding_not_ascii;
726 static int __Pyx_init_sys_getdefaultencoding_params(void) {
727  PyObject* sys;
728  PyObject* default_encoding = NULL;
729  PyObject* ascii_chars_u = NULL;
730  PyObject* ascii_chars_b = NULL;
731  const char* default_encoding_c;
732  sys = PyImport_ImportModule("sys");
733  if (!sys) goto bad;
734  default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
735  Py_DECREF(sys);
736  if (!default_encoding) goto bad;
737  default_encoding_c = PyBytes_AsString(default_encoding);
738  if (!default_encoding_c) goto bad;
739  if (strcmp(default_encoding_c, "ascii") == 0) {
740  __Pyx_sys_getdefaultencoding_not_ascii = 0;
741  } else {
742  char ascii_chars[128];
743  int c;
744  for (c = 0; c < 128; c++) {
745  ascii_chars[c] = c;
746  }
747  __Pyx_sys_getdefaultencoding_not_ascii = 1;
748  ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
749  if (!ascii_chars_u) goto bad;
750  ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
751  if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
752  PyErr_Format(
753  PyExc_ValueError,
754  "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
755  default_encoding_c);
756  goto bad;
757  }
758  Py_DECREF(ascii_chars_u);
759  Py_DECREF(ascii_chars_b);
760  }
761  Py_DECREF(default_encoding);
762  return 0;
763 bad:
764  Py_XDECREF(default_encoding);
765  Py_XDECREF(ascii_chars_u);
766  Py_XDECREF(ascii_chars_b);
767  return -1;
768 }
769 #endif
770 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
771 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
772 #else
773 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
774 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
775 static char* __PYX_DEFAULT_STRING_ENCODING;
776 static int __Pyx_init_sys_getdefaultencoding_params(void) {
777  PyObject* sys;
778  PyObject* default_encoding = NULL;
779  char* default_encoding_c;
780  sys = PyImport_ImportModule("sys");
781  if (!sys) goto bad;
782  default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
783  Py_DECREF(sys);
784  if (!default_encoding) goto bad;
785  default_encoding_c = PyBytes_AsString(default_encoding);
786  if (!default_encoding_c) goto bad;
787  __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
788  if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
789  strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
790  Py_DECREF(default_encoding);
791  return 0;
792 bad:
793  Py_XDECREF(default_encoding);
794  return -1;
795 }
796 #endif
797 #endif
798 
799 
800 /* Test for GCC > 2.95 */
801 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
802  #define likely(x) __builtin_expect(!!(x), 1)
803  #define unlikely(x) __builtin_expect(!!(x), 0)
804 #else /* !__GNUC__ or GCC < 2.95 */
805  #define likely(x) (x)
806  #define unlikely(x) (x)
807 #endif /* __GNUC__ */
808 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
809 
810 static PyObject *__pyx_m = NULL;
811 static PyObject *__pyx_d;
812 static PyObject *__pyx_b;
813 static PyObject *__pyx_cython_runtime = NULL;
814 static PyObject *__pyx_empty_tuple;
815 static PyObject *__pyx_empty_bytes;
816 static PyObject *__pyx_empty_unicode;
817 static int __pyx_lineno;
818 static int __pyx_clineno = 0;
819 static const char * __pyx_cfilenm= __FILE__;
820 static const char *__pyx_filename;
821 
822 /* Header.proto */
823 #if !defined(CYTHON_CCOMPLEX)
824  #if defined(__cplusplus)
825  #define CYTHON_CCOMPLEX 1
826  #elif defined(_Complex_I)
827  #define CYTHON_CCOMPLEX 1
828  #else
829  #define CYTHON_CCOMPLEX 0
830  #endif
831 #endif
832 #if CYTHON_CCOMPLEX
833  #ifdef __cplusplus
834  #include <complex>
835  #else
836  #include <complex.h>
837  #endif
838 #endif
839 #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
840  #undef _Complex_I
841  #define _Complex_I 1.0fj
842 #endif
843 
844 
845 static const char *__pyx_f[] = {
846  "proteus/subsurfaceTransportFunctions.pyx",
847  "__init__.pxd",
848  "type.pxd",
849 };
850 /* BufferFormatStructs.proto */
851 #define IS_UNSIGNED(type) (((type) -1) > 0)
852 struct __Pyx_StructField_;
853 #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
854 typedef struct {
855  const char* name;
856  struct __Pyx_StructField_* fields;
857  size_t size;
858  size_t arraysize[8];
859  int ndim;
860  char typegroup;
861  char is_unsigned;
862  int flags;
863 } __Pyx_TypeInfo;
864 typedef struct __Pyx_StructField_ {
865  __Pyx_TypeInfo* type;
866  const char* name;
867  size_t offset;
868 } __Pyx_StructField;
869 typedef struct {
870  __Pyx_StructField* field;
871  size_t parent_offset;
872 } __Pyx_BufFmt_StackElem;
873 typedef struct {
874  __Pyx_StructField root;
875  __Pyx_BufFmt_StackElem* head;
876  size_t fmt_offset;
877  size_t new_count, enc_count;
878  size_t struct_alignment;
879  int is_complex;
880  char enc_type;
881  char new_packmode;
882  char enc_packmode;
883  char is_valid_array;
884 } __Pyx_BufFmt_Context;
885 
886 
887 /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":697
888  * # in Cython to enable them only on the right systems.
889  *
890  * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<<
891  * ctypedef npy_int16 int16_t
892  * ctypedef npy_int32 int32_t
893  */
894 typedef npy_int8 __pyx_t_5numpy_int8_t;
895 
896 /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":698
897  *
898  * ctypedef npy_int8 int8_t
899  * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<<
900  * ctypedef npy_int32 int32_t
901  * ctypedef npy_int64 int64_t
902  */
903 typedef npy_int16 __pyx_t_5numpy_int16_t;
904 
905 /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":699
906  * ctypedef npy_int8 int8_t
907  * ctypedef npy_int16 int16_t
908  * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<<
909  * ctypedef npy_int64 int64_t
910  * #ctypedef npy_int96 int96_t
911  */
912 typedef npy_int32 __pyx_t_5numpy_int32_t;
913 
914 /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":700
915  * ctypedef npy_int16 int16_t
916  * ctypedef npy_int32 int32_t
917  * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<<
918  * #ctypedef npy_int96 int96_t
919  * #ctypedef npy_int128 int128_t
920  */
921 typedef npy_int64 __pyx_t_5numpy_int64_t;
922 
923 /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":704
924  * #ctypedef npy_int128 int128_t
925  *
926  * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<<
927  * ctypedef npy_uint16 uint16_t
928  * ctypedef npy_uint32 uint32_t
929  */
930 typedef npy_uint8 __pyx_t_5numpy_uint8_t;
931 
932 /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":705
933  *
934  * ctypedef npy_uint8 uint8_t
935  * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<<
936  * ctypedef npy_uint32 uint32_t
937  * ctypedef npy_uint64 uint64_t
938  */
939 typedef npy_uint16 __pyx_t_5numpy_uint16_t;
940 
941 /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":706
942  * ctypedef npy_uint8 uint8_t
943  * ctypedef npy_uint16 uint16_t
944  * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<<
945  * ctypedef npy_uint64 uint64_t
946  * #ctypedef npy_uint96 uint96_t
947  */
948 typedef npy_uint32 __pyx_t_5numpy_uint32_t;
949 
950 /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":707
951  * ctypedef npy_uint16 uint16_t
952  * ctypedef npy_uint32 uint32_t
953  * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<<
954  * #ctypedef npy_uint96 uint96_t
955  * #ctypedef npy_uint128 uint128_t
956  */
957 typedef npy_uint64 __pyx_t_5numpy_uint64_t;
958 
959 /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":711
960  * #ctypedef npy_uint128 uint128_t
961  *
962  * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<<
963  * ctypedef npy_float64 float64_t
964  * #ctypedef npy_float80 float80_t
965  */
966 typedef npy_float32 __pyx_t_5numpy_float32_t;
967 
968 /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":712
969  *
970  * ctypedef npy_float32 float32_t
971  * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<<
972  * #ctypedef npy_float80 float80_t
973  * #ctypedef npy_float128 float128_t
974  */
975 typedef npy_float64 __pyx_t_5numpy_float64_t;
976 
977 /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":721
978  * # The int types are mapped a bit surprising --
979  * # numpy.int corresponds to 'l' and numpy.long to 'q'
980  * ctypedef npy_long int_t # <<<<<<<<<<<<<<
981  * ctypedef npy_longlong long_t
982  * ctypedef npy_longlong longlong_t
983  */
984 typedef npy_long __pyx_t_5numpy_int_t;
985 
986 /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":722
987  * # numpy.int corresponds to 'l' and numpy.long to 'q'
988  * ctypedef npy_long int_t
989  * ctypedef npy_longlong long_t # <<<<<<<<<<<<<<
990  * ctypedef npy_longlong longlong_t
991  *
992  */
993 typedef npy_longlong __pyx_t_5numpy_long_t;
994 
995 /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":723
996  * ctypedef npy_long int_t
997  * ctypedef npy_longlong long_t
998  * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<<
999  *
1000  * ctypedef npy_ulong uint_t
1001  */
1002 typedef npy_longlong __pyx_t_5numpy_longlong_t;
1003 
1004 /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":725
1005  * ctypedef npy_longlong longlong_t
1006  *
1007  * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<<
1008  * ctypedef npy_ulonglong ulong_t
1009  * ctypedef npy_ulonglong ulonglong_t
1010  */
1011 typedef npy_ulong __pyx_t_5numpy_uint_t;
1012 
1013 /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":726
1014  *
1015  * ctypedef npy_ulong uint_t
1016  * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<<
1017  * ctypedef npy_ulonglong ulonglong_t
1018  *
1019  */
1020 typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
1021 
1022 /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":727
1023  * ctypedef npy_ulong uint_t
1024  * ctypedef npy_ulonglong ulong_t
1025  * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<<
1026  *
1027  * ctypedef npy_intp intp_t
1028  */
1029 typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
1030 
1031 /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":729
1032  * ctypedef npy_ulonglong ulonglong_t
1033  *
1034  * ctypedef npy_intp intp_t # <<<<<<<<<<<<<<
1035  * ctypedef npy_uintp uintp_t
1036  *
1037  */
1038 typedef npy_intp __pyx_t_5numpy_intp_t;
1039 
1040 /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":730
1041  *
1042  * ctypedef npy_intp intp_t
1043  * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<<
1044  *
1045  * ctypedef npy_double float_t
1046  */
1047 typedef npy_uintp __pyx_t_5numpy_uintp_t;
1048 
1049 /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":732
1050  * ctypedef npy_uintp uintp_t
1051  *
1052  * ctypedef npy_double float_t # <<<<<<<<<<<<<<
1053  * ctypedef npy_double double_t
1054  * ctypedef npy_longdouble longdouble_t
1055  */
1056 typedef npy_double __pyx_t_5numpy_float_t;
1057 
1058 /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":733
1059  *
1060  * ctypedef npy_double float_t
1061  * ctypedef npy_double double_t # <<<<<<<<<<<<<<
1062  * ctypedef npy_longdouble longdouble_t
1063  *
1064  */
1065 typedef npy_double __pyx_t_5numpy_double_t;
1066 
1067 /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":734
1068  * ctypedef npy_double float_t
1069  * ctypedef npy_double double_t
1070  * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<<
1071  *
1072  * ctypedef npy_cfloat cfloat_t
1073  */
1074 typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
1075 
1076 /* "subsurfaceTransportFunctions.pyx":14
1077  * cdef inline double double_min(double a, double b): return a if a <= b else b
1078  *
1079  * ctypedef numpy.double_t DTYPE_t # <<<<<<<<<<<<<<
1080  * #numpy.intc_t not in cython's numpy.pxd
1081  * ctypedef int ITYPE_t
1082  */
1083 typedef __pyx_t_5numpy_double_t __pyx_t_28subsurfaceTransportFunctions_DTYPE_t;
1084 
1085 /* "subsurfaceTransportFunctions.pyx":16
1086  * ctypedef numpy.double_t DTYPE_t
1087  * #numpy.intc_t not in cython's numpy.pxd
1088  * ctypedef int ITYPE_t # <<<<<<<<<<<<<<
1089  *
1090  * def setExteriorElementBoundaryTypes(int nExteriorElementBoundaries_global,
1091  */
1092 typedef int __pyx_t_28subsurfaceTransportFunctions_ITYPE_t;
1093 /* Declarations.proto */
1094 #if CYTHON_CCOMPLEX
1095  #ifdef __cplusplus
1096  typedef ::std::complex< float > __pyx_t_float_complex;
1097  #else
1098  typedef float _Complex __pyx_t_float_complex;
1099  #endif
1100 #else
1101  typedef struct { float real, imag; } __pyx_t_float_complex;
1102 #endif
1103 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);
1104 
1105 /* Declarations.proto */
1106 #if CYTHON_CCOMPLEX
1107  #ifdef __cplusplus
1108  typedef ::std::complex< double > __pyx_t_double_complex;
1109  #else
1110  typedef double _Complex __pyx_t_double_complex;
1111  #endif
1112 #else
1113  typedef struct { double real, imag; } __pyx_t_double_complex;
1114 #endif
1115 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
1116 
1117 
1118 /*--- Type declarations ---*/
1119 
1120 /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":736
1121  * ctypedef npy_longdouble longdouble_t
1122  *
1123  * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<<
1124  * ctypedef npy_cdouble cdouble_t
1125  * ctypedef npy_clongdouble clongdouble_t
1126  */
1127 typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
1128 
1129 /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":737
1130  *
1131  * ctypedef npy_cfloat cfloat_t
1132  * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<<
1133  * ctypedef npy_clongdouble clongdouble_t
1134  *
1135  */
1136 typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
1137 
1138 /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":738
1139  * ctypedef npy_cfloat cfloat_t
1140  * ctypedef npy_cdouble cdouble_t
1141  * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<<
1142  *
1143  * ctypedef npy_cdouble complex_t
1144  */
1145 typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
1146 
1147 /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":740
1148  * ctypedef npy_clongdouble clongdouble_t
1149  *
1150  * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<<
1151  *
1152  * cdef inline object PyArray_MultiIterNew1(a):
1153  */
1154 typedef npy_cdouble __pyx_t_5numpy_complex_t;
1155 
1156 /* --- Runtime support code (head) --- */
1157 /* Refnanny.proto */
1158 #ifndef CYTHON_REFNANNY
1159  #define CYTHON_REFNANNY 0
1160 #endif
1161 #if CYTHON_REFNANNY
1162  typedef struct {
1163  void (*INCREF)(void*, PyObject*, int);
1164  void (*DECREF)(void*, PyObject*, int);
1165  void (*GOTREF)(void*, PyObject*, int);
1166  void (*GIVEREF)(void*, PyObject*, int);
1167  void* (*SetupContext)(const char*, int, const char*);
1168  void (*FinishContext)(void**);
1169  } __Pyx_RefNannyAPIStruct;
1170  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1171  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
1172  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1173 #ifdef WITH_THREAD
1174  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1175  if (acquire_gil) {\
1176  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1177  __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1178  PyGILState_Release(__pyx_gilstate_save);\
1179  } else {\
1180  __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1181  }
1182 #else
1183  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1184  __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1185 #endif
1186  #define __Pyx_RefNannyFinishContext()\
1187  __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1188  #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1189  #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1190  #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1191  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1192  #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1193  #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1194  #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1195  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1196 #else
1197  #define __Pyx_RefNannyDeclarations
1198  #define __Pyx_RefNannySetupContext(name, acquire_gil)
1199  #define __Pyx_RefNannyFinishContext()
1200  #define __Pyx_INCREF(r) Py_INCREF(r)
1201  #define __Pyx_DECREF(r) Py_DECREF(r)
1202  #define __Pyx_GOTREF(r)
1203  #define __Pyx_GIVEREF(r)
1204  #define __Pyx_XINCREF(r) Py_XINCREF(r)
1205  #define __Pyx_XDECREF(r) Py_XDECREF(r)
1206  #define __Pyx_XGOTREF(r)
1207  #define __Pyx_XGIVEREF(r)
1208 #endif
1209 #define __Pyx_XDECREF_SET(r, v) do {\
1210  PyObject *tmp = (PyObject *) r;\
1211  r = v; __Pyx_XDECREF(tmp);\
1212  } while (0)
1213 #define __Pyx_DECREF_SET(r, v) do {\
1214  PyObject *tmp = (PyObject *) r;\
1215  r = v; __Pyx_DECREF(tmp);\
1216  } while (0)
1217 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1218 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1219 
1220 /* PyObjectGetAttrStr.proto */
1221 #if CYTHON_USE_TYPE_SLOTS
1222 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1223 #else
1224 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1225 #endif
1226 
1227 /* GetBuiltinName.proto */
1228 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1229 
1230 /* RaiseArgTupleInvalid.proto */
1231 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1232  Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1233 
1234 /* RaiseDoubleKeywords.proto */
1235 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1236 
1237 /* ParseKeywords.proto */
1238 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1239  PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1240  const char* function_name);
1241 
1242 /* ArgTypeTest.proto */
1243 #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
1244  ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
1245  __Pyx__ArgTypeTest(obj, type, name, exact))
1246 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
1247 
1248 /* IsLittleEndian.proto */
1249 static CYTHON_INLINE int __Pyx_Is_Little_Endian(void);
1250 
1251 /* BufferFormatCheck.proto */
1252 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts);
1253 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
1254  __Pyx_BufFmt_StackElem* stack,
1255  __Pyx_TypeInfo* type);
1256 
1257 /* BufferGetAndValidate.proto */
1258 #define __Pyx_GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)\
1259  ((obj == Py_None || obj == NULL) ?\
1260  (__Pyx_ZeroBuffer(buf), 0) :\
1261  __Pyx__GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack))
1262 static int __Pyx__GetBufferAndValidate(Py_buffer* buf, PyObject* obj,
1263  __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
1264 static void __Pyx_ZeroBuffer(Py_buffer* buf);
1265 static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
1266 static Py_ssize_t __Pyx_minusones[] = { -1, -1, -1, -1, -1, -1, -1, -1 };
1267 static Py_ssize_t __Pyx_zeros[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
1268 
1269 /* BufferIndexError.proto */
1270 static void __Pyx_RaiseBufferIndexError(int axis);
1271 
1272 #define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0)
1273 #define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1)
1274 /* PyThreadStateGet.proto */
1275 #if CYTHON_FAST_THREAD_STATE
1276 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1277 #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
1278 #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
1279 #else
1280 #define __Pyx_PyThreadState_declare
1281 #define __Pyx_PyThreadState_assign
1282 #define __Pyx_PyErr_Occurred() PyErr_Occurred()
1283 #endif
1284 
1285 /* PyErrFetchRestore.proto */
1286 #if CYTHON_FAST_THREAD_STATE
1287 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1288 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1289 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1290 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1291 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1292 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1293 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1294 #if CYTHON_COMPILING_IN_CPYTHON
1295 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1296 #else
1297 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1298 #endif
1299 #else
1300 #define __Pyx_PyErr_Clear() PyErr_Clear()
1301 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1302 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1303 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1304 #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
1305 #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
1306 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1307 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1308 #endif
1309 
1310 /* DictGetItem.proto */
1311 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
1312 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
1313 #define __Pyx_PyObject_Dict_GetItem(obj, name)\
1314  (likely(PyDict_CheckExact(obj)) ?\
1315  __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
1316 #else
1317 #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
1318 #define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name)
1319 #endif
1320 
1321 #define __Pyx_BufPtrStrided3d(type, buf, i0, s0, i1, s1, i2, s2) (type)((char*)buf + i0 * s0 + i1 * s1 + i2 * s2)
1322 /* GetItemInt.proto */
1323 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1324  (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1325  __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
1326  (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
1327  __Pyx_GetItemInt_Generic(o, to_py_func(i))))
1328 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1329  (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1330  __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1331  (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
1332 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1333  int wraparound, int boundscheck);
1334 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1335  (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1336  __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1337  (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
1338 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1339  int wraparound, int boundscheck);
1340 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1341 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1342  int is_list, int wraparound, int boundscheck);
1343 
1344 /* ObjectGetItem.proto */
1345 #if CYTHON_USE_TYPE_SLOTS
1346 static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
1347 #else
1348 #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key)
1349 #endif
1350 
1351 /* PyFloatBinop.proto */
1352 #if !CYTHON_COMPILING_IN_PYPY
1353 static PyObject* __Pyx_PyFloat_AddObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check);
1354 #else
1355 #define __Pyx_PyFloat_AddObjC(op1, op2, floatval, inplace, zerodivision_check)\
1356  (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
1357 #endif
1358 
1359 #define __Pyx_BufPtrStrided4d(type, buf, i0, s0, i1, s1, i2, s2, i3, s3) (type)((char*)buf + i0 * s0 + i1 * s1 + i2 * s2 + i3 * s3)
1360 /* PyFunctionFastCall.proto */
1361 #if CYTHON_FAST_PYCALL
1362 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1363  __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1364 #if 1 || PY_VERSION_HEX < 0x030600B1
1365 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1366 #else
1367 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1368 #endif
1369 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1370  (sizeof(char [1 - 2*!(cond)]) - 1)
1371 #ifndef Py_MEMBER_SIZE
1372 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1373 #endif
1374  static size_t __pyx_pyframe_localsplus_offset = 0;
1375  #include "frameobject.h"
1376  #define __Pxy_PyFrame_Initialize_Offsets()\
1377  ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1378  (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1379  #define __Pyx_PyFrame_GetLocalsplus(frame)\
1380  (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1381 #endif
1382 
1383 /* PyCFunctionFastCall.proto */
1384 #if CYTHON_FAST_PYCCALL
1385 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1386 #else
1387 #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
1388 #endif
1389 
1390 /* PyObjectCall.proto */
1391 #if CYTHON_COMPILING_IN_CPYTHON
1392 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1393 #else
1394 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1395 #endif
1396 
1397 /* PyDictVersioning.proto */
1398 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1399 #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
1400 #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
1401 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1402  (version_var) = __PYX_GET_DICT_VERSION(dict);\
1403  (cache_var) = (value);
1404 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1405  static PY_UINT64_T __pyx_dict_version = 0;\
1406  static PyObject *__pyx_dict_cached_value = NULL;\
1407  if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1408  (VAR) = __pyx_dict_cached_value;\
1409  } else {\
1410  (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1411  __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1412  }\
1413 }
1414 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1415 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1416 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1417 #else
1418 #define __PYX_GET_DICT_VERSION(dict) (0)
1419 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1420 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
1421 #endif
1422 
1423 /* GetModuleGlobalName.proto */
1424 #if CYTHON_USE_DICT_VERSIONS
1425 #define __Pyx_GetModuleGlobalName(var, name) {\
1426  static PY_UINT64_T __pyx_dict_version = 0;\
1427  static PyObject *__pyx_dict_cached_value = NULL;\
1428  (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1429  (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1430  __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1431 }
1432 #define __Pyx_GetModuleGlobalNameUncached(var, name) {\
1433  PY_UINT64_T __pyx_dict_version;\
1434  PyObject *__pyx_dict_cached_value;\
1435  (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1436 }
1437 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1438 #else
1439 #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1440 #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1441 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1442 #endif
1443 
1444 /* ExtTypeTest.proto */
1445 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
1446 
1447 /* PyObjectCall2Args.proto */
1448 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1449 
1450 /* PyObjectCallMethO.proto */
1451 #if CYTHON_COMPILING_IN_CPYTHON
1452 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1453 #endif
1454 
1455 /* PyObjectCallOneArg.proto */
1456 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1457 
1458 /* pyobject_as_double.proto */
1459 static double __Pyx__PyObject_AsDouble(PyObject* obj);
1460 #if CYTHON_COMPILING_IN_PYPY
1461 #define __Pyx_PyObject_AsDouble(obj)\
1462 (likely(PyFloat_CheckExact(obj)) ? PyFloat_AS_DOUBLE(obj) :\
1463  likely(PyInt_CheckExact(obj)) ?\
1464  PyFloat_AsDouble(obj) : __Pyx__PyObject_AsDouble(obj))
1465 #else
1466 #define __Pyx_PyObject_AsDouble(obj)\
1467 ((likely(PyFloat_CheckExact(obj))) ?\
1468  PyFloat_AS_DOUBLE(obj) : __Pyx__PyObject_AsDouble(obj))
1469 #endif
1470 
1471 /* RaiseTooManyValuesToUnpack.proto */
1472 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1473 
1474 /* RaiseNeedMoreValuesToUnpack.proto */
1475 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1476 
1477 /* RaiseNoneIterError.proto */
1478 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
1479 
1480 /* RaiseException.proto */
1481 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1482 
1483 /* GetTopmostException.proto */
1484 #if CYTHON_USE_EXC_INFO_STACK
1485 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1486 #endif
1487 
1488 /* SaveResetException.proto */
1489 #if CYTHON_FAST_THREAD_STATE
1490 #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1491 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1492 #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1493 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1494 #else
1495 #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
1496 #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
1497 #endif
1498 
1499 /* PyErrExceptionMatches.proto */
1500 #if CYTHON_FAST_THREAD_STATE
1501 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1502 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1503 #else
1504 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
1505 #endif
1506 
1507 /* GetException.proto */
1508 #if CYTHON_FAST_THREAD_STATE
1509 #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
1510 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1511 #else
1512 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1513 #endif
1514 
1515 /* TypeImport.proto */
1516 #ifndef __PYX_HAVE_RT_ImportType_proto
1517 #define __PYX_HAVE_RT_ImportType_proto
1518 enum __Pyx_ImportType_CheckSize {
1519  __Pyx_ImportType_CheckSize_Error = 0,
1520  __Pyx_ImportType_CheckSize_Warn = 1,
1521  __Pyx_ImportType_CheckSize_Ignore = 2
1522 };
1523 static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
1524 #endif
1525 
1526 /* Import.proto */
1527 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1528 
1529 /* CLineInTraceback.proto */
1530 #ifdef CYTHON_CLINE_IN_TRACEBACK
1531 #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1532 #else
1533 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1534 #endif
1535 
1536 /* CodeObjectCache.proto */
1537 typedef struct {
1538  PyCodeObject* code_object;
1539  int code_line;
1540 } __Pyx_CodeObjectCacheEntry;
1541 struct __Pyx_CodeObjectCache {
1542  int count;
1543  int max_count;
1544  __Pyx_CodeObjectCacheEntry* entries;
1545 };
1546 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1547 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1548 static PyCodeObject *__pyx_find_code_object(int code_line);
1549 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1550 
1551 /* AddTraceback.proto */
1552 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1553  int py_line, const char *filename);
1554 
1555 /* BufferStructDeclare.proto */
1556 typedef struct {
1557  Py_ssize_t shape, strides, suboffsets;
1558 } __Pyx_Buf_DimInfo;
1559 typedef struct {
1560  size_t refcount;
1561  Py_buffer pybuffer;
1562 } __Pyx_Buffer;
1563 typedef struct {
1564  __Pyx_Buffer *rcbuffer;
1565  char *data;
1566  __Pyx_Buf_DimInfo diminfo[8];
1567 } __Pyx_LocalBuf_ND;
1568 
1569 #if PY_MAJOR_VERSION < 3
1570  static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
1571  static void __Pyx_ReleaseBuffer(Py_buffer *view);
1572 #else
1573  #define __Pyx_GetBuffer PyObject_GetBuffer
1574  #define __Pyx_ReleaseBuffer PyBuffer_Release
1575 #endif
1576 
1577 
1578 /* CIntToPy.proto */
1579 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
1580 
1581 /* CIntToPy.proto */
1582 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value);
1583 
1584 /* CIntToPy.proto */
1585 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1586 
1587 /* RealImag.proto */
1588 #if CYTHON_CCOMPLEX
1589  #ifdef __cplusplus
1590  #define __Pyx_CREAL(z) ((z).real())
1591  #define __Pyx_CIMAG(z) ((z).imag())
1592  #else
1593  #define __Pyx_CREAL(z) (__real__(z))
1594  #define __Pyx_CIMAG(z) (__imag__(z))
1595  #endif
1596 #else
1597  #define __Pyx_CREAL(z) ((z).real)
1598  #define __Pyx_CIMAG(z) ((z).imag)
1599 #endif
1600 #if defined(__cplusplus) && CYTHON_CCOMPLEX\
1601  && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
1602  #define __Pyx_SET_CREAL(z,x) ((z).real(x))
1603  #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
1604 #else
1605  #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
1606  #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
1607 #endif
1608 
1609 /* Arithmetic.proto */
1610 #if CYTHON_CCOMPLEX
1611  #define __Pyx_c_eq_float(a, b) ((a)==(b))
1612  #define __Pyx_c_sum_float(a, b) ((a)+(b))
1613  #define __Pyx_c_diff_float(a, b) ((a)-(b))
1614  #define __Pyx_c_prod_float(a, b) ((a)*(b))
1615  #define __Pyx_c_quot_float(a, b) ((a)/(b))
1616  #define __Pyx_c_neg_float(a) (-(a))
1617  #ifdef __cplusplus
1618  #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
1619  #define __Pyx_c_conj_float(z) (::std::conj(z))
1620  #if 1
1621  #define __Pyx_c_abs_float(z) (::std::abs(z))
1622  #define __Pyx_c_pow_float(a, b) (::std::pow(a, b))
1623  #endif
1624  #else
1625  #define __Pyx_c_is_zero_float(z) ((z)==0)
1626  #define __Pyx_c_conj_float(z) (conjf(z))
1627  #if 1
1628  #define __Pyx_c_abs_float(z) (cabsf(z))
1629  #define __Pyx_c_pow_float(a, b) (cpowf(a, b))
1630  #endif
1631  #endif
1632 #else
1633  static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
1634  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
1635  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
1636  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
1637  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
1638  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
1639  static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex);
1640  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
1641  #if 1
1642  static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex);
1643  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
1644  #endif
1645 #endif
1646 
1647 /* Arithmetic.proto */
1648 #if CYTHON_CCOMPLEX
1649  #define __Pyx_c_eq_double(a, b) ((a)==(b))
1650  #define __Pyx_c_sum_double(a, b) ((a)+(b))
1651  #define __Pyx_c_diff_double(a, b) ((a)-(b))
1652  #define __Pyx_c_prod_double(a, b) ((a)*(b))
1653  #define __Pyx_c_quot_double(a, b) ((a)/(b))
1654  #define __Pyx_c_neg_double(a) (-(a))
1655  #ifdef __cplusplus
1656  #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
1657  #define __Pyx_c_conj_double(z) (::std::conj(z))
1658  #if 1
1659  #define __Pyx_c_abs_double(z) (::std::abs(z))
1660  #define __Pyx_c_pow_double(a, b) (::std::pow(a, b))
1661  #endif
1662  #else
1663  #define __Pyx_c_is_zero_double(z) ((z)==0)
1664  #define __Pyx_c_conj_double(z) (conj(z))
1665  #if 1
1666  #define __Pyx_c_abs_double(z) (cabs(z))
1667  #define __Pyx_c_pow_double(a, b) (cpow(a, b))
1668  #endif
1669  #endif
1670 #else
1671  static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
1672  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
1673  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
1674  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
1675  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
1676  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
1677  static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex);
1678  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
1679  #if 1
1680  static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex);
1681  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
1682  #endif
1683 #endif
1684 
1685 /* CIntToPy.proto */
1686 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value);
1687 
1688 /* CIntFromPy.proto */
1689 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1690 
1691 /* CIntFromPy.proto */
1692 static CYTHON_INLINE Py_intptr_t __Pyx_PyInt_As_Py_intptr_t(PyObject *);
1693 
1694 /* CIntFromPy.proto */
1695 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1696 
1697 /* FastTypeChecks.proto */
1698 #if CYTHON_COMPILING_IN_CPYTHON
1699 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1700 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1701 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1702 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1703 #else
1704 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1705 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1706 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1707 #endif
1708 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1709 
1710 /* CheckBinaryVersion.proto */
1711 static int __Pyx_check_binary_version(void);
1712 
1713 /* InitStrings.proto */
1714 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1715 
1716 
1717 /* Module declarations from 'cpython.buffer' */
1718 
1719 /* Module declarations from 'libc.string' */
1720 
1721 /* Module declarations from 'libc.stdio' */
1722 
1723 /* Module declarations from '__builtin__' */
1724 
1725 /* Module declarations from 'cpython.type' */
1726 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
1727 
1728 /* Module declarations from 'cpython' */
1729 
1730 /* Module declarations from 'cpython.object' */
1731 
1732 /* Module declarations from 'cpython.ref' */
1733 
1734 /* Module declarations from 'cpython.mem' */
1735 
1736 /* Module declarations from 'numpy' */
1737 
1738 /* Module declarations from 'numpy' */
1739 static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
1740 static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
1741 static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
1742 static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
1743 static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
1744 static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/
1745 
1746 /* Module declarations from 'subsurfaceTransportFunctions' */
1747 static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t = { "ITYPE_t", NULL, sizeof(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t), 0 };
1748 static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t = { "DTYPE_t", NULL, sizeof(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t), { 0 }, 0, 'R', 0, 0 };
1749 #define __Pyx_MODULE_NAME "subsurfaceTransportFunctions"
1750 extern int __pyx_module_is_main_subsurfaceTransportFunctions;
1751 int __pyx_module_is_main_subsurfaceTransportFunctions = 0;
1752 
1753 /* Implementation of 'subsurfaceTransportFunctions' */
1754 static PyObject *__pyx_builtin_range;
1755 static PyObject *__pyx_builtin_RuntimeError;
1756 static PyObject *__pyx_builtin_ValueError;
1757 static PyObject *__pyx_builtin_ImportError;
1758 static const char __pyx_k_I[] = "I";
1759 static const char __pyx_k_J[] = "J";
1760 static const char __pyx_k_d[] = "d";
1761 static const char __pyx_k_i[] = "i";
1762 static const char __pyx_k_j[] = "j";
1763 static const char __pyx_k_k[] = "k";
1764 static const char __pyx_k_m[] = "m";
1765 static const char __pyx_k_n[] = "n";
1766 static const char __pyx_k_q[] = "q";
1767 static const char __pyx_k_t[] = "t";
1768 static const char __pyx_k_v[] = "v";
1769 static const char __pyx_k_w[] = "w";
1770 static const char __pyx_k_x[] = "x";
1771 static const char __pyx_k_dS[] = "dS";
1772 static const char __pyx_k_dV[] = "dV";
1773 static const char __pyx_k_df[] = "df";
1774 static const char __pyx_k_dm[] = "dm";
1775 static const char __pyx_k_eN[] = "eN";
1776 static const char __pyx_k_ii[] = "ii";
1777 static const char __pyx_k_kb[] = "kb";
1778 static const char __pyx_k_mt[] = "mt";
1779 static const char __pyx_k_nd[] = "nd";
1780 static const char __pyx_k_pi[] = "pi";
1781 static const char __pyx_k_xc[] = "xc";
1782 static const char __pyx_k_yc[] = "yc";
1783 static const char __pyx_k_KWr[] = "KWr";
1784 static const char __pyx_k_KWs[] = "KWs";
1785 static const char __pyx_k_dmt[] = "dmt";
1786 static const char __pyx_k_dot[] = "dot";
1787 static const char __pyx_k_ebN[] = "ebN";
1788 static const char __pyx_k_l2g[] = "l2g";
1789 static const char __pyx_k_nnz[] = "nnz";
1790 static const char __pyx_k_q_m[] = "q_m";
1791 static const char __pyx_k_q_r[] = "q_r";
1792 static const char __pyx_k_q_u[] = "q_u";
1793 static const char __pyx_k_q_x[] = "q_x";
1794 static const char __pyx_k_rho[] = "rho";
1795 static const char __pyx_k_sum[] = "sum";
1796 static const char __pyx_k_u_j[] = "u_j";
1797 static const char __pyx_k_vol[] = "vol";
1798 static const char __pyx_k_a_eN[] = "a_eN";
1799 static const char __pyx_k_a_up[] = "a_up";
1800 static const char __pyx_k_beta[] = "beta";
1801 static const char __pyx_k_ebNE[] = "ebNE";
1802 static const char __pyx_k_f_up[] = "f_up";
1803 static const char __pyx_k_flat[] = "flat";
1804 static const char __pyx_k_flux[] = "flux";
1805 static const char __pyx_k_main[] = "__main__";
1806 static const char __pyx_k_name[] = "__name__";
1807 static const char __pyx_k_one8[] = "one8";
1808 static const char __pyx_k_psiC[] = "psiC";
1809 static const char __pyx_k_q_dm[] = "q_dm";
1810 static const char __pyx_k_q_kr[] = "q_kr";
1811 static const char __pyx_k_q_mt[] = "q_mt";
1812 static const char __pyx_k_rho2[] = "rho2";
1813 static const char __pyx_k_rhom[] = "rhom";
1814 static const char __pyx_k_sBar[] = "sBar";
1815 static const char __pyx_k_test[] = "__test__";
1816 static const char __pyx_k_u_eN[] = "u_eN";
1817 static const char __pyx_k_vBar[] = "vBar";
1818 static const char __pyx_k_a_avg[] = "a_avg";
1819 static const char __pyx_k_alpha[] = "alpha";
1820 static const char __pyx_k_clock[] = "clock";
1821 static const char __pyx_k_denom[] = "denom";
1822 static const char __pyx_k_drhom[] = "drhom";
1823 static const char __pyx_k_kr_eN[] = "kr_eN";
1824 static const char __pyx_k_matID[] = "matID";
1825 static const char __pyx_k_numer[] = "numer";
1826 static const char __pyx_k_numpy[] = "numpy";
1827 static const char __pyx_k_pcBar[] = "pcBar";
1828 static const char __pyx_k_q_dkr[] = "q_dkr";
1829 static const char __pyx_k_q_dmt[] = "q_dmt";
1830 static const char __pyx_k_range[] = "range";
1831 static const char __pyx_k_shape[] = "shape";
1832 static const char __pyx_k_u_dof[] = "u_dof";
1833 static const char __pyx_k_u_l2g[] = "u_l2g";
1834 static const char __pyx_k_vBar2[] = "vBar2";
1835 static const char __pyx_k_vol_e[] = "vol_e";
1836 static const char __pyx_k_zeros[] = "zeros";
1837 static const char __pyx_k_a_neig[] = "a_neig";
1838 static const char __pyx_k_colind[] = "colind";
1839 static const char __pyx_k_dkr_up[] = "dkr_up";
1840 static const char __pyx_k_import[] = "__import__";
1841 static const char __pyx_k_mt_avg[] = "mt_avg";
1842 static const char __pyx_k_nSpace[] = "nSpace";
1843 static const char __pyx_k_phi_eN[] = "phi_eN";
1844 static const char __pyx_k_picard[] = "picard";
1845 static const char __pyx_k_q_alin[] = "q_alin";
1846 static const char __pyx_k_q_detJ[] = "q_detJ";
1847 static const char __pyx_k_q_flin[] = "q_flin";
1848 static const char __pyx_k_q_mass[] = "q_mass";
1849 static const char __pyx_k_q_vals[] = "q_vals";
1850 static const char __pyx_k_rowptr[] = "rowptr";
1851 static const char __pyx_k_thetaR[] = "thetaR";
1852 static const char __pyx_k_thetaS[] = "thetaS";
1853 static const char __pyx_k_thetaW[] = "thetaW";
1854 static const char __pyx_k_u_neig[] = "u_neig";
1855 static const char __pyx_k_volume[] = "volume";
1856 static const char __pyx_k_weight[] = "weight";
1857 static const char __pyx_k_df_dofs[] = "df_dofs";
1858 static const char __pyx_k_eN_left[] = "eN_left";
1859 static const char __pyx_k_gravity[] = "gravity";
1860 static const char __pyx_k_kr_neig[] = "kr_neig";
1861 static const char __pyx_k_nSpace2[] = "nSpace2";
1862 static const char __pyx_k_omega_e[] = "omega_e";
1863 static const char __pyx_k_pcBar_n[] = "pcBar_n";
1864 static const char __pyx_k_q_dmass[] = "q_dmass";
1865 static const char __pyx_k_q_kr_up[] = "q_kr_up";
1866 static const char __pyx_k_thetaSR[] = "thetaSR";
1867 static const char __pyx_k_dmtj_avg[] = "dmtj_avg";
1868 static const char __pyx_k_eN_right[] = "eN_right";
1869 static const char __pyx_k_ebq_vals[] = "ebq_vals";
1870 static const char __pyx_k_integral[] = "integral";
1871 static const char __pyx_k_material[] = "material";
1872 static const char __pyx_k_phi_neig[] = "phi_neig";
1873 static const char __pyx_k_q_grad_u[] = "q_grad_u";
1874 static const char __pyx_k_q_grad_v[] = "q_grad_v";
1875 static const char __pyx_k_q_grad_w[] = "q_grad_w";
1876 static const char __pyx_k_ebN_local[] = "ebN_local";
1877 static const char __pyx_k_pcBar_nM1[] = "pcBar_nM1";
1878 static const char __pyx_k_pcBar_nM2[] = "pcBar_nM2";
1879 static const char __pyx_k_sqrt_sBar[] = "sqrt_sBar";
1880 static const char __pyx_k_transient[] = "transient";
1881 static const char __pyx_k_volFactor[] = "volFactor";
1882 static const char __pyx_k_zVelocity[] = "zVelocity";
1883 static const char __pyx_k_zvelocity[] = "zvelocity";
1884 static const char __pyx_k_DKWr_DpsiC[] = "DKWr_DpsiC";
1885 static const char __pyx_k_ValueError[] = "ValueError";
1886 static const char __pyx_k_matID_neig[] = "matID_neig";
1887 static const char __pyx_k_nAvgWeight[] = "nAvgWeight";
1888 static const char __pyx_k_upwindFlag[] = "upwindFlag";
1889 static const char __pyx_k_DsBar_DpsiC[] = "DsBar_DpsiC";
1890 static const char __pyx_k_DvBar_DpsiC[] = "DvBar_DpsiC";
1891 static const char __pyx_k_ImportError[] = "ImportError";
1892 static const char __pyx_k_eN_neighbor[] = "eN_neighbor";
1893 static const char __pyx_k_RuntimeError[] = "RuntimeError";
1894 static const char __pyx_k_tForReversal[] = "tForReversal";
1895 static const char __pyx_k_DthetaW_DpsiC[] = "DthetaW_DpsiC";
1896 static const char __pyx_k_material_left[] = "material_left";
1897 static const char __pyx_k_weak_residual[] = "weak_residual";
1898 static const char __pyx_k_material_right[] = "material_right";
1899 static const char __pyx_k_ebq_global_vals[] = "ebq_global_vals";
1900 static const char __pyx_k_elementJacobian[] = "elementJacobian";
1901 static const char __pyx_k_elementResidual[] = "elementResidual";
1902 static const char __pyx_k_onePlus_pcBar_n[] = "onePlus_pcBar_n";
1903 static const char __pyx_k_nElements_global[] = "nElements_global";
1904 static const char __pyx_k_nDOF_test_element[] = "nDOF_test_element";
1905 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
1906 static const char __pyx_k_material_functions[] = "material_functions";
1907 static const char __pyx_k_nDOF_trial_element[] = "nDOF_trial_element";
1908 static const char __pyx_k_updateMass_weakAvg[] = "updateMass_weakAvg";
1909 static const char __pyx_k_calculateNormalFlux[] = "calculateNormalFlux";
1910 static const char __pyx_k_thisElementIsUpwind[] = "thisElementIsUpwind";
1911 static const char __pyx_k_elementBoundaryTypes[] = "elementBoundaryTypes";
1912 static const char __pyx_k_elementMaterialTypes[] = "elementMaterialTypes";
1913 static const char __pyx_k_elementNeighborsArray[] = "elementNeighborsArray";
1914 static const char __pyx_k_elementBoundariesArray[] = "elementBoundariesArray";
1915 static const char __pyx_k_jacobian_weak_residual[] = "jacobian_weak_residual";
1916 static const char __pyx_k_characteristic_velocity[] = "characteristic_velocity";
1917 static const char __pyx_k_elementBarycentersArray[] = "elementBarycentersArray";
1918 static const char __pyx_k_nElementBoundaries_global[] = "nElementBoundaries_global";
1919 static const char __pyx_k_setElementBoundariesArray[] = "setElementBoundariesArray";
1920 static const char __pyx_k_RE_NCP1_getElementJacobian[] = "RE_NCP1_getElementJacobian";
1921 static const char __pyx_k_RE_NCP1_getElementResidual[] = "RE_NCP1_getElementResidual";
1922 static const char __pyx_k_nElementBoundaries_element[] = "nElementBoundaries_element";
1923 static const char __pyx_k_updateMassJacobian_weakAvg[] = "updateMassJacobian_weakAvg";
1924 static const char __pyx_k_vortexElementVelocityEval3[] = "vortexElementVelocityEval3";
1925 static const char __pyx_k_vortexElementVelocityEval4[] = "vortexElementVelocityEval4";
1926 static const char __pyx_k_helicalElementVelocityEval3[] = "helicalElementVelocityEval3";
1927 static const char __pyx_k_helicalElementVelocityEval4[] = "helicalElementVelocityEval4";
1928 static const char __pyx_k_characteristic_velocity_dofs[] = "characteristic_velocity_dofs";
1929 static const char __pyx_k_elementBoundaryElementsArray[] = "elementBoundaryElementsArray";
1930 static const char __pyx_k_elementBoundaryMaterialTypes[] = "elementBoundaryMaterialTypes";
1931 static const char __pyx_k_subsurfaceTransportFunctions[] = "subsurfaceTransportFunctions";
1932 static const char __pyx_k_exteriorElementBoundariesArray[] = "exteriorElementBoundariesArray";
1933 static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import";
1934 static const char __pyx_k_setExteriorElementBoundaryTypes[] = "setExteriorElementBoundaryTypes";
1935 static const char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)";
1936 static const char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd";
1937 static const char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported";
1938 static const char __pyx_k_RE_NCP1_evaluateElementCoefficie[] = "RE_NCP1_evaluateElementCoefficients_Linear";
1939 static const char __pyx_k_computeSimpleCharacteristicVeloc[] = "computeSimpleCharacteristicVelocityFromElementVelocity";
1940 static const char __pyx_k_evaluateScalarMaterialFunctionOv[] = "evaluateScalarMaterialFunctionOverElements";
1941 static const char __pyx_k_evaluateSparseTensorMaterialFunc[] = "evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage";
1942 static const char __pyx_k_evaluateVectorMaterialFunctionOv[] = "evaluateVectorMaterialFunctionOverElements";
1943 static const char __pyx_k_exteriorElementBoundaryMaterialT[] = "exteriorElementBoundaryMaterialTypes";
1944 static const char __pyx_k_nExteriorElementBoundaries_globa[] = "nExteriorElementBoundaries_global";
1945 static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import";
1946 static const char __pyx_k_proteus_subsurfaceTransportFunct[] = "proteus/subsurfaceTransportFunctions.pyx";
1947 static const char __pyx_k_rotatingGaussianElementVelocityE[] = "rotatingGaussianElementVelocityEval3";
1948 static const char __pyx_k_setScalarMaterialFunctionOverEle[] = "setScalarMaterialFunctionOverElements";
1949 static const char __pyx_k_setScalarMaterialFunctionOverGlo[] = "setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage";
1950 static const char __pyx_k_setSparseTensorMaterialFunctionO[] = "setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage";
1951 static const char __pyx_k_setVectorMaterialFunctionOverEle[] = "setVectorMaterialFunctionOverElements";
1952 static const char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short.";
1953 static const char __pyx_k_RE_NCP1_evaluateElementCoefficie_2[] = "RE_NCP1_evaluateElementCoefficients_VGM";
1954 static const char __pyx_k_computeSimpleCharacteristicVeloc_2[] = "computeSimpleCharacteristicVelocityFromVelocityDOFs";
1955 static const char __pyx_k_evaluateScalarMaterialFunctionOv_2[] = "evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage";
1956 static const char __pyx_k_evaluateScalarMaterialFunctionOv_3[] = "evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage";
1957 static const char __pyx_k_evaluateSparseTensorMaterialFunc_2[] = "evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage";
1958 static const char __pyx_k_rotatingGaussianElementVelocityE_2[] = "rotatingGaussianElementVelocityEval4";
1959 static const char __pyx_k_setScalarMaterialFunctionOverEle_2[] = "setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage";
1960 static const char __pyx_k_setSparseTensorMaterialFunctionO_2[] = "setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage";
1961 static PyObject *__pyx_n_s_DKWr_DpsiC;
1962 static PyObject *__pyx_n_s_DsBar_DpsiC;
1963 static PyObject *__pyx_n_s_DthetaW_DpsiC;
1964 static PyObject *__pyx_n_s_DvBar_DpsiC;
1965 static PyObject *__pyx_kp_u_Format_string_allocated_too_shor;
1966 static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2;
1967 static PyObject *__pyx_n_s_I;
1968 static PyObject *__pyx_n_s_ImportError;
1969 static PyObject *__pyx_n_s_J;
1970 static PyObject *__pyx_n_s_KWr;
1971 static PyObject *__pyx_n_s_KWs;
1972 static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor;
1973 static PyObject *__pyx_n_s_RE_NCP1_evaluateElementCoefficie;
1974 static PyObject *__pyx_n_s_RE_NCP1_evaluateElementCoefficie_2;
1975 static PyObject *__pyx_n_s_RE_NCP1_getElementJacobian;
1976 static PyObject *__pyx_n_s_RE_NCP1_getElementResidual;
1977 static PyObject *__pyx_n_s_RuntimeError;
1978 static PyObject *__pyx_n_s_ValueError;
1979 static PyObject *__pyx_n_s_a_avg;
1980 static PyObject *__pyx_n_s_a_eN;
1981 static PyObject *__pyx_n_s_a_neig;
1982 static PyObject *__pyx_n_s_a_up;
1983 static PyObject *__pyx_n_s_alpha;
1984 static PyObject *__pyx_n_s_beta;
1985 static PyObject *__pyx_n_s_calculateNormalFlux;
1986 static PyObject *__pyx_n_s_characteristic_velocity;
1987 static PyObject *__pyx_n_s_characteristic_velocity_dofs;
1988 static PyObject *__pyx_n_s_cline_in_traceback;
1989 static PyObject *__pyx_n_s_clock;
1990 static PyObject *__pyx_n_s_colind;
1991 static PyObject *__pyx_n_s_computeSimpleCharacteristicVeloc;
1992 static PyObject *__pyx_n_s_computeSimpleCharacteristicVeloc_2;
1993 static PyObject *__pyx_n_s_d;
1994 static PyObject *__pyx_n_s_dS;
1995 static PyObject *__pyx_n_s_dV;
1996 static PyObject *__pyx_n_s_denom;
1997 static PyObject *__pyx_n_s_df;
1998 static PyObject *__pyx_n_s_df_dofs;
1999 static PyObject *__pyx_n_s_dkr_up;
2000 static PyObject *__pyx_n_s_dm;
2001 static PyObject *__pyx_n_s_dmt;
2002 static PyObject *__pyx_n_s_dmtj_avg;
2003 static PyObject *__pyx_n_s_dot;
2004 static PyObject *__pyx_n_s_drhom;
2005 static PyObject *__pyx_n_s_eN;
2006 static PyObject *__pyx_n_s_eN_left;
2007 static PyObject *__pyx_n_s_eN_neighbor;
2008 static PyObject *__pyx_n_s_eN_right;
2009 static PyObject *__pyx_n_s_ebN;
2010 static PyObject *__pyx_n_s_ebNE;
2011 static PyObject *__pyx_n_s_ebN_local;
2012 static PyObject *__pyx_n_s_ebq_global_vals;
2013 static PyObject *__pyx_n_s_ebq_vals;
2014 static PyObject *__pyx_n_s_elementBarycentersArray;
2015 static PyObject *__pyx_n_s_elementBoundariesArray;
2016 static PyObject *__pyx_n_s_elementBoundaryElementsArray;
2017 static PyObject *__pyx_n_s_elementBoundaryMaterialTypes;
2018 static PyObject *__pyx_n_s_elementBoundaryTypes;
2019 static PyObject *__pyx_n_s_elementJacobian;
2020 static PyObject *__pyx_n_s_elementMaterialTypes;
2021 static PyObject *__pyx_n_s_elementNeighborsArray;
2022 static PyObject *__pyx_n_s_elementResidual;
2023 static PyObject *__pyx_n_s_evaluateScalarMaterialFunctionOv;
2024 static PyObject *__pyx_n_s_evaluateScalarMaterialFunctionOv_2;
2025 static PyObject *__pyx_n_s_evaluateScalarMaterialFunctionOv_3;
2026 static PyObject *__pyx_n_s_evaluateSparseTensorMaterialFunc;
2027 static PyObject *__pyx_n_s_evaluateSparseTensorMaterialFunc_2;
2028 static PyObject *__pyx_n_s_evaluateVectorMaterialFunctionOv;
2029 static PyObject *__pyx_n_s_exteriorElementBoundariesArray;
2030 static PyObject *__pyx_n_s_exteriorElementBoundaryMaterialT;
2031 static PyObject *__pyx_n_s_f_up;
2032 static PyObject *__pyx_n_s_flat;
2033 static PyObject *__pyx_n_s_flux;
2034 static PyObject *__pyx_n_s_gravity;
2035 static PyObject *__pyx_n_s_helicalElementVelocityEval3;
2036 static PyObject *__pyx_n_s_helicalElementVelocityEval4;
2037 static PyObject *__pyx_n_s_i;
2038 static PyObject *__pyx_n_s_ii;
2039 static PyObject *__pyx_n_s_import;
2040 static PyObject *__pyx_n_s_integral;
2041 static PyObject *__pyx_n_s_j;
2042 static PyObject *__pyx_n_s_jacobian_weak_residual;
2043 static PyObject *__pyx_n_s_k;
2044 static PyObject *__pyx_n_s_kb;
2045 static PyObject *__pyx_n_s_kr_eN;
2046 static PyObject *__pyx_n_s_kr_neig;
2047 static PyObject *__pyx_n_s_l2g;
2048 static PyObject *__pyx_n_s_m;
2049 static PyObject *__pyx_n_s_main;
2050 static PyObject *__pyx_n_s_matID;
2051 static PyObject *__pyx_n_s_matID_neig;
2052 static PyObject *__pyx_n_s_material;
2053 static PyObject *__pyx_n_s_material_functions;
2054 static PyObject *__pyx_n_s_material_left;
2055 static PyObject *__pyx_n_s_material_right;
2056 static PyObject *__pyx_n_s_mt;
2057 static PyObject *__pyx_n_s_mt_avg;
2058 static PyObject *__pyx_n_s_n;
2059 static PyObject *__pyx_n_s_nAvgWeight;
2060 static PyObject *__pyx_n_s_nDOF_test_element;
2061 static PyObject *__pyx_n_s_nDOF_trial_element;
2062 static PyObject *__pyx_n_s_nElementBoundaries_element;
2063 static PyObject *__pyx_n_s_nElementBoundaries_global;
2064 static PyObject *__pyx_n_s_nElements_global;
2065 static PyObject *__pyx_n_s_nExteriorElementBoundaries_globa;
2066 static PyObject *__pyx_n_s_nSpace;
2067 static PyObject *__pyx_n_s_nSpace2;
2068 static PyObject *__pyx_n_s_name;
2069 static PyObject *__pyx_n_s_nd;
2070 static PyObject *__pyx_n_s_nnz;
2071 static PyObject *__pyx_n_s_numer;
2072 static PyObject *__pyx_n_s_numpy;
2073 static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to;
2074 static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor;
2075 static PyObject *__pyx_n_s_omega_e;
2076 static PyObject *__pyx_n_s_one8;
2077 static PyObject *__pyx_n_s_onePlus_pcBar_n;
2078 static PyObject *__pyx_n_s_pcBar;
2079 static PyObject *__pyx_n_s_pcBar_n;
2080 static PyObject *__pyx_n_s_pcBar_nM1;
2081 static PyObject *__pyx_n_s_pcBar_nM2;
2082 static PyObject *__pyx_n_s_phi_eN;
2083 static PyObject *__pyx_n_s_phi_neig;
2084 static PyObject *__pyx_n_s_pi;
2085 static PyObject *__pyx_n_s_picard;
2086 static PyObject *__pyx_kp_s_proteus_subsurfaceTransportFunct;
2087 static PyObject *__pyx_n_s_psiC;
2088 static PyObject *__pyx_n_s_q;
2089 static PyObject *__pyx_n_s_q_alin;
2090 static PyObject *__pyx_n_s_q_detJ;
2091 static PyObject *__pyx_n_s_q_dkr;
2092 static PyObject *__pyx_n_s_q_dm;
2093 static PyObject *__pyx_n_s_q_dmass;
2094 static PyObject *__pyx_n_s_q_dmt;
2095 static PyObject *__pyx_n_s_q_flin;
2096 static PyObject *__pyx_n_s_q_grad_u;
2097 static PyObject *__pyx_n_s_q_grad_v;
2098 static PyObject *__pyx_n_s_q_grad_w;
2099 static PyObject *__pyx_n_s_q_kr;
2100 static PyObject *__pyx_n_s_q_kr_up;
2101 static PyObject *__pyx_n_s_q_m;
2102 static PyObject *__pyx_n_s_q_mass;
2103 static PyObject *__pyx_n_s_q_mt;
2104 static PyObject *__pyx_n_s_q_r;
2105 static PyObject *__pyx_n_s_q_u;
2106 static PyObject *__pyx_n_s_q_vals;
2107 static PyObject *__pyx_n_s_q_x;
2108 static PyObject *__pyx_n_s_range;
2109 static PyObject *__pyx_n_s_rho;
2110 static PyObject *__pyx_n_s_rho2;
2111 static PyObject *__pyx_n_s_rhom;
2112 static PyObject *__pyx_n_s_rotatingGaussianElementVelocityE;
2113 static PyObject *__pyx_n_s_rotatingGaussianElementVelocityE_2;
2114 static PyObject *__pyx_n_s_rowptr;
2115 static PyObject *__pyx_n_s_sBar;
2116 static PyObject *__pyx_n_s_setElementBoundariesArray;
2117 static PyObject *__pyx_n_s_setExteriorElementBoundaryTypes;
2118 static PyObject *__pyx_n_s_setScalarMaterialFunctionOverEle;
2119 static PyObject *__pyx_n_s_setScalarMaterialFunctionOverEle_2;
2120 static PyObject *__pyx_n_s_setScalarMaterialFunctionOverGlo;
2121 static PyObject *__pyx_n_s_setSparseTensorMaterialFunctionO;
2122 static PyObject *__pyx_n_s_setSparseTensorMaterialFunctionO_2;
2123 static PyObject *__pyx_n_s_setVectorMaterialFunctionOverEle;
2124 static PyObject *__pyx_n_s_shape;
2125 static PyObject *__pyx_n_s_sqrt_sBar;
2126 static PyObject *__pyx_n_s_subsurfaceTransportFunctions;
2127 static PyObject *__pyx_n_s_sum;
2128 static PyObject *__pyx_n_s_t;
2129 static PyObject *__pyx_n_s_tForReversal;
2130 static PyObject *__pyx_n_s_test;
2131 static PyObject *__pyx_n_s_thetaR;
2132 static PyObject *__pyx_n_s_thetaS;
2133 static PyObject *__pyx_n_s_thetaSR;
2134 static PyObject *__pyx_n_s_thetaW;
2135 static PyObject *__pyx_n_s_thisElementIsUpwind;
2136 static PyObject *__pyx_n_s_transient;
2137 static PyObject *__pyx_n_s_u_dof;
2138 static PyObject *__pyx_n_s_u_eN;
2139 static PyObject *__pyx_n_s_u_j;
2140 static PyObject *__pyx_n_s_u_l2g;
2141 static PyObject *__pyx_n_s_u_neig;
2142 static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd;
2143 static PyObject *__pyx_n_s_updateMassJacobian_weakAvg;
2144 static PyObject *__pyx_n_s_updateMass_weakAvg;
2145 static PyObject *__pyx_n_s_upwindFlag;
2146 static PyObject *__pyx_n_s_v;
2147 static PyObject *__pyx_n_s_vBar;
2148 static PyObject *__pyx_n_s_vBar2;
2149 static PyObject *__pyx_n_s_vol;
2150 static PyObject *__pyx_n_s_volFactor;
2151 static PyObject *__pyx_n_s_vol_e;
2152 static PyObject *__pyx_n_s_volume;
2153 static PyObject *__pyx_n_s_vortexElementVelocityEval3;
2154 static PyObject *__pyx_n_s_vortexElementVelocityEval4;
2155 static PyObject *__pyx_n_s_w;
2156 static PyObject *__pyx_n_s_weak_residual;
2157 static PyObject *__pyx_n_s_weight;
2158 static PyObject *__pyx_n_s_x;
2159 static PyObject *__pyx_n_s_xc;
2160 static PyObject *__pyx_n_s_yc;
2161 static PyObject *__pyx_n_s_zVelocity;
2162 static PyObject *__pyx_n_s_zeros;
2163 static PyObject *__pyx_n_s_zvelocity;
2164 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_setExteriorElementBoundaryTypes(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nExteriorElementBoundaries_global, PyArrayObject *__pyx_v_exteriorElementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryElementsArray, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_exteriorElementBoundaryMaterialTypes); /* proto */
2165 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_2setElementBoundariesArray(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nElementBoundaries_global, PyArrayObject *__pyx_v_elementBoundaryElementsArray, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_elementBoundaryMaterialTypes); /* proto */
2166 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_4setScalarMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions); /* proto */
2167 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_6setVectorMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions); /* proto */
2168 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_8setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions); /* proto */
2169 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_10setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions); /* proto */
2170 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_12setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions); /* proto */
2171 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_14setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions); /* proto */
2172 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_16evaluateScalarMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions); /* proto */
2173 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_18evaluateVectorMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions); /* proto */
2174 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_20evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions); /* proto */
2175 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_22evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, double __pyx_v_t, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions); /* proto */
2176 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_24evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions); /* proto */
2177 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_26evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, double __pyx_v_t, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions); /* proto */
2178 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_28RE_NCP1_evaluateElementCoefficients_Linear(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_rho, PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_rowptr, PyArrayObject *__pyx_v_colind, PyArrayObject *__pyx_v_KWs, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, PyArrayObject *__pyx_v_elementNeighborsArray, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_q_flin, PyArrayObject *__pyx_v_q_alin); /* proto */
2179 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_30RE_NCP1_evaluateElementCoefficients_VGM(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_rho, double __pyx_v_beta, PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_alpha, PyArrayObject *__pyx_v_n, PyArrayObject *__pyx_v_thetaR, PyArrayObject *__pyx_v_thetaSR, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, PyArrayObject *__pyx_v_elementNeighborsArray, PyArrayObject *__pyx_v_elementBarycentersArray, PyArrayObject *__pyx_v_elementMaterialTypes, int __pyx_v_nDOF_trial_element, PyArrayObject *__pyx_v_u_l2g, PyArrayObject *__pyx_v_u_dof, CYTHON_UNUSED PyArrayObject *__pyx_v_q_x, PyArrayObject *__pyx_v_q_u, PyArrayObject *__pyx_v_q_mass, PyArrayObject *__pyx_v_q_dmass, PyArrayObject *__pyx_v_q_r, PyArrayObject *__pyx_v_q_kr, PyArrayObject *__pyx_v_q_dkr, PyArrayObject *__pyx_v_q_kr_up); /* proto */
2180 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_32RE_NCP1_getElementResidual(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_rowptr, PyArrayObject *__pyx_v_colind, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, CYTHON_UNUSED PyArrayObject *__pyx_v_elementNeighborsArray, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBarycentersArray, int __pyx_v_nDOF_test_element, PyArrayObject *__pyx_v_q_u, PyArrayObject *__pyx_v_q_grad_u, PyArrayObject *__pyx_v_q_grad_w, PyArrayObject *__pyx_v_q_detJ, PyArrayObject *__pyx_v_q_m, PyArrayObject *__pyx_v_q_mt, PyArrayObject *__pyx_v_q_r, PyArrayObject *__pyx_v_q_kr, PyArrayObject *__pyx_v_q_kr_up, PyArrayObject *__pyx_v_q_flin, PyArrayObject *__pyx_v_q_alin, PyArrayObject *__pyx_v_elementResidual); /* proto */
2181 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_34RE_NCP1_getElementJacobian(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_rowptr, PyArrayObject *__pyx_v_colind, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, CYTHON_UNUSED PyArrayObject *__pyx_v_elementNeighborsArray, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBarycentersArray, int __pyx_v_nDOF_test_element, int __pyx_v_nDOF_trial_element, PyArrayObject *__pyx_v_q_u, CYTHON_UNUSED PyArrayObject *__pyx_v_q_grad_u, PyArrayObject *__pyx_v_q_grad_w, PyArrayObject *__pyx_v_q_grad_v, PyArrayObject *__pyx_v_q_detJ, PyArrayObject *__pyx_v_q_m, CYTHON_UNUSED PyArrayObject *__pyx_v_q_dm, PyArrayObject *__pyx_v_q_mt, PyArrayObject *__pyx_v_q_dmt, PyArrayObject *__pyx_v_q_r, PyArrayObject *__pyx_v_q_kr, CYTHON_UNUSED PyArrayObject *__pyx_v_q_dkr, PyArrayObject *__pyx_v_q_kr_up, PyArrayObject *__pyx_v_q_flin, PyArrayObject *__pyx_v_q_alin, PyArrayObject *__pyx_v_elementJacobian); /* proto */
2182 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_36updateMass_weakAvg(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_mt, PyArrayObject *__pyx_v_w, PyArrayObject *__pyx_v_dV, PyArrayObject *__pyx_v_weak_residual); /* proto */
2183 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_38updateMassJacobian_weakAvg(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_dmt, PyArrayObject *__pyx_v_w, PyArrayObject *__pyx_v_v, PyArrayObject *__pyx_v_dV, PyArrayObject *__pyx_v_jacobian_weak_residual); /* proto */
2184 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_40calculateNormalFlux(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_v, PyArrayObject *__pyx_v_n, PyArrayObject *__pyx_v_dS, PyArrayObject *__pyx_v_flux); /* proto */
2185 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_42computeSimpleCharacteristicVelocityFromElementVelocity(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_df, PyArrayObject *__pyx_v_characteristic_velocity, PyArrayObject *__pyx_v_dm, PyArrayObject *__pyx_v_dV); /* proto */
2186 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_44computeSimpleCharacteristicVelocityFromVelocityDOFs(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_df_dofs, PyArrayObject *__pyx_v_characteristic_velocity_dofs, PyArrayObject *__pyx_v_l2g, PyArrayObject *__pyx_v_dm, PyArrayObject *__pyx_v_dV); /* proto */
2187 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_46rotatingGaussianElementVelocityEval3(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v, double __pyx_v_zvelocity); /* proto */
2188 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_48rotatingGaussianElementVelocityEval4(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v, double __pyx_v_zvelocity); /* proto */
2189 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_50helicalElementVelocityEval3(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_zVelocity, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v); /* proto */
2190 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_52helicalElementVelocityEval4(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_zVelocity, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v); /* proto */
2191 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_54vortexElementVelocityEval3(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v); /* proto */
2192 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_56vortexElementVelocityEval4(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v); /* proto */
2193 static PyObject *__pyx_float_0_0;
2194 static PyObject *__pyx_float_0_5;
2195 static PyObject *__pyx_float_2_0;
2196 static PyObject *__pyx_float_1_0eneg_20;
2197 static PyObject *__pyx_slice_;
2198 static PyObject *__pyx_tuple__2;
2199 static PyObject *__pyx_tuple__3;
2200 static PyObject *__pyx_tuple__4;
2201 static PyObject *__pyx_tuple__5;
2202 static PyObject *__pyx_tuple__6;
2203 static PyObject *__pyx_tuple__7;
2204 static PyObject *__pyx_tuple__9;
2205 static PyObject *__pyx_tuple__11;
2206 static PyObject *__pyx_tuple__13;
2207 static PyObject *__pyx_tuple__15;
2208 static PyObject *__pyx_tuple__17;
2209 static PyObject *__pyx_tuple__19;
2210 static PyObject *__pyx_tuple__21;
2211 static PyObject *__pyx_tuple__23;
2212 static PyObject *__pyx_tuple__25;
2213 static PyObject *__pyx_tuple__27;
2214 static PyObject *__pyx_tuple__29;
2215 static PyObject *__pyx_tuple__31;
2216 static PyObject *__pyx_tuple__33;
2217 static PyObject *__pyx_tuple__35;
2218 static PyObject *__pyx_tuple__37;
2219 static PyObject *__pyx_tuple__39;
2220 static PyObject *__pyx_tuple__41;
2221 static PyObject *__pyx_tuple__43;
2222 static PyObject *__pyx_tuple__45;
2223 static PyObject *__pyx_tuple__47;
2224 static PyObject *__pyx_tuple__49;
2225 static PyObject *__pyx_tuple__51;
2226 static PyObject *__pyx_tuple__53;
2227 static PyObject *__pyx_tuple__55;
2228 static PyObject *__pyx_tuple__57;
2229 static PyObject *__pyx_tuple__59;
2230 static PyObject *__pyx_tuple__61;
2231 static PyObject *__pyx_tuple__63;
2232 static PyObject *__pyx_codeobj__8;
2233 static PyObject *__pyx_codeobj__10;
2234 static PyObject *__pyx_codeobj__12;
2235 static PyObject *__pyx_codeobj__14;
2236 static PyObject *__pyx_codeobj__16;
2237 static PyObject *__pyx_codeobj__18;
2238 static PyObject *__pyx_codeobj__20;
2239 static PyObject *__pyx_codeobj__22;
2240 static PyObject *__pyx_codeobj__24;
2241 static PyObject *__pyx_codeobj__26;
2242 static PyObject *__pyx_codeobj__28;
2243 static PyObject *__pyx_codeobj__30;
2244 static PyObject *__pyx_codeobj__32;
2245 static PyObject *__pyx_codeobj__34;
2246 static PyObject *__pyx_codeobj__36;
2247 static PyObject *__pyx_codeobj__38;
2248 static PyObject *__pyx_codeobj__40;
2249 static PyObject *__pyx_codeobj__42;
2250 static PyObject *__pyx_codeobj__44;
2251 static PyObject *__pyx_codeobj__46;
2252 static PyObject *__pyx_codeobj__48;
2253 static PyObject *__pyx_codeobj__50;
2254 static PyObject *__pyx_codeobj__52;
2255 static PyObject *__pyx_codeobj__54;
2256 static PyObject *__pyx_codeobj__56;
2257 static PyObject *__pyx_codeobj__58;
2258 static PyObject *__pyx_codeobj__60;
2259 static PyObject *__pyx_codeobj__62;
2260 static PyObject *__pyx_codeobj__64;
2261 /* Late includes */
2262 
2263 /* "subsurfaceTransportFunctions.pyx":11
2264  * double sin(double x)
2265  * double M_PI
2266  * cdef inline double double_max(double a, double b): return a if a >= b else b # <<<<<<<<<<<<<<
2267  * cdef inline double double_min(double a, double b): return a if a <= b else b
2268  *
2269  */
2270 
2271 static CYTHON_INLINE double __pyx_f_28subsurfaceTransportFunctions_double_max(double __pyx_v_a, double __pyx_v_b) {
2272  double __pyx_r;
2273  __Pyx_RefNannyDeclarations
2274  double __pyx_t_1;
2275  __Pyx_RefNannySetupContext("double_max", 0);
2276  if (((__pyx_v_a >= __pyx_v_b) != 0)) {
2277  __pyx_t_1 = __pyx_v_a;
2278  } else {
2279  __pyx_t_1 = __pyx_v_b;
2280  }
2281  __pyx_r = __pyx_t_1;
2282  goto __pyx_L0;
2283 
2284  /* function exit code */
2285  __pyx_L0:;
2286  __Pyx_RefNannyFinishContext();
2287  return __pyx_r;
2288 }
2289 
2290 /* "subsurfaceTransportFunctions.pyx":12
2291  * double M_PI
2292  * cdef inline double double_max(double a, double b): return a if a >= b else b
2293  * cdef inline double double_min(double a, double b): return a if a <= b else b # <<<<<<<<<<<<<<
2294  *
2295  * ctypedef numpy.double_t DTYPE_t
2296  */
2297 
2298 static CYTHON_INLINE double __pyx_f_28subsurfaceTransportFunctions_double_min(double __pyx_v_a, double __pyx_v_b) {
2299  double __pyx_r;
2300  __Pyx_RefNannyDeclarations
2301  double __pyx_t_1;
2302  __Pyx_RefNannySetupContext("double_min", 0);
2303  if (((__pyx_v_a <= __pyx_v_b) != 0)) {
2304  __pyx_t_1 = __pyx_v_a;
2305  } else {
2306  __pyx_t_1 = __pyx_v_b;
2307  }
2308  __pyx_r = __pyx_t_1;
2309  goto __pyx_L0;
2310 
2311  /* function exit code */
2312  __pyx_L0:;
2313  __Pyx_RefNannyFinishContext();
2314  return __pyx_r;
2315 }
2316 
2317 /* "subsurfaceTransportFunctions.pyx":18
2318  * ctypedef int ITYPE_t
2319  *
2320  * def setExteriorElementBoundaryTypes(int nExteriorElementBoundaries_global, # <<<<<<<<<<<<<<
2321  * numpy.ndarray[ITYPE_t,ndim=1] exteriorElementBoundariesArray,
2322  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
2323  */
2324 
2325 /* Python wrapper */
2326 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_1setExteriorElementBoundaryTypes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2327 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_1setExteriorElementBoundaryTypes = {"setExteriorElementBoundaryTypes", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_1setExteriorElementBoundaryTypes, METH_VARARGS|METH_KEYWORDS, 0};
2328 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_1setExteriorElementBoundaryTypes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2329  int __pyx_v_nExteriorElementBoundaries_global;
2330  PyArrayObject *__pyx_v_exteriorElementBoundariesArray = 0;
2331  PyArrayObject *__pyx_v_elementBoundaryElementsArray = 0;
2332  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
2333  PyArrayObject *__pyx_v_exteriorElementBoundaryMaterialTypes = 0;
2334  int __pyx_lineno = 0;
2335  const char *__pyx_filename = NULL;
2336  int __pyx_clineno = 0;
2337  PyObject *__pyx_r = 0;
2338  __Pyx_RefNannyDeclarations
2339  __Pyx_RefNannySetupContext("setExteriorElementBoundaryTypes (wrapper)", 0);
2340  {
2341  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nExteriorElementBoundaries_globa,&__pyx_n_s_exteriorElementBoundariesArray,&__pyx_n_s_elementBoundaryElementsArray,&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_exteriorElementBoundaryMaterialT,0};
2342  PyObject* values[5] = {0,0,0,0,0};
2343  if (unlikely(__pyx_kwds)) {
2344  Py_ssize_t kw_args;
2345  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2346  switch (pos_args) {
2347  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2348  CYTHON_FALLTHROUGH;
2349  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2350  CYTHON_FALLTHROUGH;
2351  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2352  CYTHON_FALLTHROUGH;
2353  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2354  CYTHON_FALLTHROUGH;
2355  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2356  CYTHON_FALLTHROUGH;
2357  case 0: break;
2358  default: goto __pyx_L5_argtuple_error;
2359  }
2360  kw_args = PyDict_Size(__pyx_kwds);
2361  switch (pos_args) {
2362  case 0:
2363  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nExteriorElementBoundaries_globa)) != 0)) kw_args--;
2364  else goto __pyx_L5_argtuple_error;
2365  CYTHON_FALLTHROUGH;
2366  case 1:
2367  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exteriorElementBoundariesArray)) != 0)) kw_args--;
2368  else {
2369  __Pyx_RaiseArgtupleInvalid("setExteriorElementBoundaryTypes", 1, 5, 5, 1); __PYX_ERR(0, 18, __pyx_L3_error)
2370  }
2371  CYTHON_FALLTHROUGH;
2372  case 2:
2373  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryElementsArray)) != 0)) kw_args--;
2374  else {
2375  __Pyx_RaiseArgtupleInvalid("setExteriorElementBoundaryTypes", 1, 5, 5, 2); __PYX_ERR(0, 18, __pyx_L3_error)
2376  }
2377  CYTHON_FALLTHROUGH;
2378  case 3:
2379  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
2380  else {
2381  __Pyx_RaiseArgtupleInvalid("setExteriorElementBoundaryTypes", 1, 5, 5, 3); __PYX_ERR(0, 18, __pyx_L3_error)
2382  }
2383  CYTHON_FALLTHROUGH;
2384  case 4:
2385  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exteriorElementBoundaryMaterialT)) != 0)) kw_args--;
2386  else {
2387  __Pyx_RaiseArgtupleInvalid("setExteriorElementBoundaryTypes", 1, 5, 5, 4); __PYX_ERR(0, 18, __pyx_L3_error)
2388  }
2389  }
2390  if (unlikely(kw_args > 0)) {
2391  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setExteriorElementBoundaryTypes") < 0)) __PYX_ERR(0, 18, __pyx_L3_error)
2392  }
2393  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
2394  goto __pyx_L5_argtuple_error;
2395  } else {
2396  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2397  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2398  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2399  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2400  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
2401  }
2402  __pyx_v_nExteriorElementBoundaries_global = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_nExteriorElementBoundaries_global == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 18, __pyx_L3_error)
2403  __pyx_v_exteriorElementBoundariesArray = ((PyArrayObject *)values[1]);
2404  __pyx_v_elementBoundaryElementsArray = ((PyArrayObject *)values[2]);
2405  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[3]);
2406  __pyx_v_exteriorElementBoundaryMaterialTypes = ((PyArrayObject *)values[4]);
2407  }
2408  goto __pyx_L4_argument_unpacking_done;
2409  __pyx_L5_argtuple_error:;
2410  __Pyx_RaiseArgtupleInvalid("setExteriorElementBoundaryTypes", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 18, __pyx_L3_error)
2411  __pyx_L3_error:;
2412  __Pyx_AddTraceback("subsurfaceTransportFunctions.setExteriorElementBoundaryTypes", __pyx_clineno, __pyx_lineno, __pyx_filename);
2413  __Pyx_RefNannyFinishContext();
2414  return NULL;
2415  __pyx_L4_argument_unpacking_done:;
2416  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_exteriorElementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "exteriorElementBoundariesArray", 0))) __PYX_ERR(0, 19, __pyx_L1_error)
2417  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryElementsArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryElementsArray", 0))) __PYX_ERR(0, 20, __pyx_L1_error)
2418  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) __PYX_ERR(0, 21, __pyx_L1_error)
2419  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_exteriorElementBoundaryMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "exteriorElementBoundaryMaterialTypes", 0))) __PYX_ERR(0, 22, __pyx_L1_error)
2420  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_setExteriorElementBoundaryTypes(__pyx_self, __pyx_v_nExteriorElementBoundaries_global, __pyx_v_exteriorElementBoundariesArray, __pyx_v_elementBoundaryElementsArray, __pyx_v_elementMaterialTypes, __pyx_v_exteriorElementBoundaryMaterialTypes);
2421 
2422  /* function exit code */
2423  goto __pyx_L0;
2424  __pyx_L1_error:;
2425  __pyx_r = NULL;
2426  __pyx_L0:;
2427  __Pyx_RefNannyFinishContext();
2428  return __pyx_r;
2429 }
2430 
2431 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_setExteriorElementBoundaryTypes(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nExteriorElementBoundaries_global, PyArrayObject *__pyx_v_exteriorElementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryElementsArray, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_exteriorElementBoundaryMaterialTypes) {
2432  int __pyx_v_ebNE;
2433  int __pyx_v_ebN;
2434  int __pyx_v_eN;
2435  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryElementsArray;
2436  __Pyx_Buffer __pyx_pybuffer_elementBoundaryElementsArray;
2437  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
2438  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
2439  __Pyx_LocalBuf_ND __pyx_pybuffernd_exteriorElementBoundariesArray;
2440  __Pyx_Buffer __pyx_pybuffer_exteriorElementBoundariesArray;
2441  __Pyx_LocalBuf_ND __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes;
2442  __Pyx_Buffer __pyx_pybuffer_exteriorElementBoundaryMaterialTypes;
2443  PyObject *__pyx_r = NULL;
2444  __Pyx_RefNannyDeclarations
2445  int __pyx_t_1;
2446  int __pyx_t_2;
2447  int __pyx_t_3;
2448  Py_ssize_t __pyx_t_4;
2449  int __pyx_t_5;
2450  Py_ssize_t __pyx_t_6;
2451  int __pyx_lineno = 0;
2452  const char *__pyx_filename = NULL;
2453  int __pyx_clineno = 0;
2454  __Pyx_RefNannySetupContext("setExteriorElementBoundaryTypes", 0);
2455  __pyx_pybuffer_exteriorElementBoundariesArray.pybuffer.buf = NULL;
2456  __pyx_pybuffer_exteriorElementBoundariesArray.refcount = 0;
2457  __pyx_pybuffernd_exteriorElementBoundariesArray.data = NULL;
2458  __pyx_pybuffernd_exteriorElementBoundariesArray.rcbuffer = &__pyx_pybuffer_exteriorElementBoundariesArray;
2459  __pyx_pybuffer_elementBoundaryElementsArray.pybuffer.buf = NULL;
2460  __pyx_pybuffer_elementBoundaryElementsArray.refcount = 0;
2461  __pyx_pybuffernd_elementBoundaryElementsArray.data = NULL;
2462  __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer = &__pyx_pybuffer_elementBoundaryElementsArray;
2463  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
2464  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
2465  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
2466  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
2467  __pyx_pybuffer_exteriorElementBoundaryMaterialTypes.pybuffer.buf = NULL;
2468  __pyx_pybuffer_exteriorElementBoundaryMaterialTypes.refcount = 0;
2469  __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.data = NULL;
2470  __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.rcbuffer = &__pyx_pybuffer_exteriorElementBoundaryMaterialTypes;
2471  {
2472  __Pyx_BufFmt_StackElem __pyx_stack[1];
2473  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_exteriorElementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_exteriorElementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 18, __pyx_L1_error)
2474  }
2475  __pyx_pybuffernd_exteriorElementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_exteriorElementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_exteriorElementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_exteriorElementBoundariesArray.rcbuffer->pybuffer.shape[0];
2476  {
2477  __Pyx_BufFmt_StackElem __pyx_stack[1];
2478  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryElementsArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 18, __pyx_L1_error)
2479  }
2480  __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.shape[1];
2481  {
2482  __Pyx_BufFmt_StackElem __pyx_stack[1];
2483  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 18, __pyx_L1_error)
2484  }
2485  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
2486  {
2487  __Pyx_BufFmt_StackElem __pyx_stack[1];
2488  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_exteriorElementBoundaryMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 18, __pyx_L1_error)
2489  }
2490  __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.rcbuffer->pybuffer.shape[0];
2491 
2492  /* "subsurfaceTransportFunctions.pyx":24
2493  * numpy.ndarray[ITYPE_t,ndim=1] exteriorElementBoundaryMaterialTypes):
2494  * cdef int ebNE,ebN,eN
2495  * for ebNE in range(nExteriorElementBoundaries_global): # <<<<<<<<<<<<<<
2496  * ebN = exteriorElementBoundariesArray[ebNE]
2497  * eN = elementBoundaryElementsArray[ebN,0]
2498  */
2499  __pyx_t_1 = __pyx_v_nExteriorElementBoundaries_global;
2500  __pyx_t_2 = __pyx_t_1;
2501  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
2502  __pyx_v_ebNE = __pyx_t_3;
2503 
2504  /* "subsurfaceTransportFunctions.pyx":25
2505  * cdef int ebNE,ebN,eN
2506  * for ebNE in range(nExteriorElementBoundaries_global):
2507  * ebN = exteriorElementBoundariesArray[ebNE] # <<<<<<<<<<<<<<
2508  * eN = elementBoundaryElementsArray[ebN,0]
2509  * exteriorElementBoundaryMaterialTypes[ebNE] = elementMaterialTypes[eN]
2510  */
2511  __pyx_t_4 = __pyx_v_ebNE;
2512  __pyx_t_5 = -1;
2513  if (__pyx_t_4 < 0) {
2514  __pyx_t_4 += __pyx_pybuffernd_exteriorElementBoundariesArray.diminfo[0].shape;
2515  if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
2516  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_exteriorElementBoundariesArray.diminfo[0].shape)) __pyx_t_5 = 0;
2517  if (unlikely(__pyx_t_5 != -1)) {
2518  __Pyx_RaiseBufferIndexError(__pyx_t_5);
2519  __PYX_ERR(0, 25, __pyx_L1_error)
2520  }
2521  __pyx_v_ebN = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_exteriorElementBoundariesArray.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_exteriorElementBoundariesArray.diminfo[0].strides));
2522 
2523  /* "subsurfaceTransportFunctions.pyx":26
2524  * for ebNE in range(nExteriorElementBoundaries_global):
2525  * ebN = exteriorElementBoundariesArray[ebNE]
2526  * eN = elementBoundaryElementsArray[ebN,0] # <<<<<<<<<<<<<<
2527  * exteriorElementBoundaryMaterialTypes[ebNE] = elementMaterialTypes[eN]
2528  *
2529  */
2530  __pyx_t_4 = __pyx_v_ebN;
2531  __pyx_t_6 = 0;
2532  __pyx_t_5 = -1;
2533  if (__pyx_t_4 < 0) {
2534  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape;
2535  if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
2536  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape)) __pyx_t_5 = 0;
2537  if (__pyx_t_6 < 0) {
2538  __pyx_t_6 += __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape;
2539  if (unlikely(__pyx_t_6 < 0)) __pyx_t_5 = 1;
2540  } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape)) __pyx_t_5 = 1;
2541  if (unlikely(__pyx_t_5 != -1)) {
2542  __Pyx_RaiseBufferIndexError(__pyx_t_5);
2543  __PYX_ERR(0, 26, __pyx_L1_error)
2544  }
2545  __pyx_v_eN = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].strides, __pyx_t_6, __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].strides));
2546 
2547  /* "subsurfaceTransportFunctions.pyx":27
2548  * ebN = exteriorElementBoundariesArray[ebNE]
2549  * eN = elementBoundaryElementsArray[ebN,0]
2550  * exteriorElementBoundaryMaterialTypes[ebNE] = elementMaterialTypes[eN] # <<<<<<<<<<<<<<
2551  *
2552  * def setElementBoundariesArray(int nElementBoundaries_global,
2553  */
2554  __pyx_t_6 = __pyx_v_eN;
2555  __pyx_t_5 = -1;
2556  if (__pyx_t_6 < 0) {
2557  __pyx_t_6 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
2558  if (unlikely(__pyx_t_6 < 0)) __pyx_t_5 = 0;
2559  } else if (unlikely(__pyx_t_6 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_5 = 0;
2560  if (unlikely(__pyx_t_5 != -1)) {
2561  __Pyx_RaiseBufferIndexError(__pyx_t_5);
2562  __PYX_ERR(0, 27, __pyx_L1_error)
2563  }
2564  __pyx_t_4 = __pyx_v_ebNE;
2565  __pyx_t_5 = -1;
2566  if (__pyx_t_4 < 0) {
2567  __pyx_t_4 += __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.diminfo[0].shape;
2568  if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
2569  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.diminfo[0].shape)) __pyx_t_5 = 0;
2570  if (unlikely(__pyx_t_5 != -1)) {
2571  __Pyx_RaiseBufferIndexError(__pyx_t_5);
2572  __PYX_ERR(0, 27, __pyx_L1_error)
2573  }
2574  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
2575  }
2576 
2577  /* "subsurfaceTransportFunctions.pyx":18
2578  * ctypedef int ITYPE_t
2579  *
2580  * def setExteriorElementBoundaryTypes(int nExteriorElementBoundaries_global, # <<<<<<<<<<<<<<
2581  * numpy.ndarray[ITYPE_t,ndim=1] exteriorElementBoundariesArray,
2582  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
2583  */
2584 
2585  /* function exit code */
2586  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2587  goto __pyx_L0;
2588  __pyx_L1_error:;
2589  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
2590  __Pyx_PyThreadState_declare
2591  __Pyx_PyThreadState_assign
2592  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
2593  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer);
2594  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
2595  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_exteriorElementBoundariesArray.rcbuffer->pybuffer);
2596  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.rcbuffer->pybuffer);
2597  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
2598  __Pyx_AddTraceback("subsurfaceTransportFunctions.setExteriorElementBoundaryTypes", __pyx_clineno, __pyx_lineno, __pyx_filename);
2599  __pyx_r = NULL;
2600  goto __pyx_L2;
2601  __pyx_L0:;
2602  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer);
2603  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
2604  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_exteriorElementBoundariesArray.rcbuffer->pybuffer);
2605  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_exteriorElementBoundaryMaterialTypes.rcbuffer->pybuffer);
2606  __pyx_L2:;
2607  __Pyx_XGIVEREF(__pyx_r);
2608  __Pyx_RefNannyFinishContext();
2609  return __pyx_r;
2610 }
2611 
2612 /* "subsurfaceTransportFunctions.pyx":29
2613  * exteriorElementBoundaryMaterialTypes[ebNE] = elementMaterialTypes[eN]
2614  *
2615  * def setElementBoundariesArray(int nElementBoundaries_global, # <<<<<<<<<<<<<<
2616  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
2617  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
2618  */
2619 
2620 /* Python wrapper */
2621 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_3setElementBoundariesArray(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2622 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_3setElementBoundariesArray = {"setElementBoundariesArray", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_3setElementBoundariesArray, METH_VARARGS|METH_KEYWORDS, 0};
2623 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_3setElementBoundariesArray(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2624  int __pyx_v_nElementBoundaries_global;
2625  PyArrayObject *__pyx_v_elementBoundaryElementsArray = 0;
2626  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
2627  PyArrayObject *__pyx_v_elementBoundaryMaterialTypes = 0;
2628  int __pyx_lineno = 0;
2629  const char *__pyx_filename = NULL;
2630  int __pyx_clineno = 0;
2631  PyObject *__pyx_r = 0;
2632  __Pyx_RefNannyDeclarations
2633  __Pyx_RefNannySetupContext("setElementBoundariesArray (wrapper)", 0);
2634  {
2635  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nElementBoundaries_global,&__pyx_n_s_elementBoundaryElementsArray,&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_elementBoundaryMaterialTypes,0};
2636  PyObject* values[4] = {0,0,0,0};
2637  if (unlikely(__pyx_kwds)) {
2638  Py_ssize_t kw_args;
2639  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2640  switch (pos_args) {
2641  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2642  CYTHON_FALLTHROUGH;
2643  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2644  CYTHON_FALLTHROUGH;
2645  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2646  CYTHON_FALLTHROUGH;
2647  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2648  CYTHON_FALLTHROUGH;
2649  case 0: break;
2650  default: goto __pyx_L5_argtuple_error;
2651  }
2652  kw_args = PyDict_Size(__pyx_kwds);
2653  switch (pos_args) {
2654  case 0:
2655  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElementBoundaries_global)) != 0)) kw_args--;
2656  else goto __pyx_L5_argtuple_error;
2657  CYTHON_FALLTHROUGH;
2658  case 1:
2659  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryElementsArray)) != 0)) kw_args--;
2660  else {
2661  __Pyx_RaiseArgtupleInvalid("setElementBoundariesArray", 1, 4, 4, 1); __PYX_ERR(0, 29, __pyx_L3_error)
2662  }
2663  CYTHON_FALLTHROUGH;
2664  case 2:
2665  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
2666  else {
2667  __Pyx_RaiseArgtupleInvalid("setElementBoundariesArray", 1, 4, 4, 2); __PYX_ERR(0, 29, __pyx_L3_error)
2668  }
2669  CYTHON_FALLTHROUGH;
2670  case 3:
2671  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryMaterialTypes)) != 0)) kw_args--;
2672  else {
2673  __Pyx_RaiseArgtupleInvalid("setElementBoundariesArray", 1, 4, 4, 3); __PYX_ERR(0, 29, __pyx_L3_error)
2674  }
2675  }
2676  if (unlikely(kw_args > 0)) {
2677  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setElementBoundariesArray") < 0)) __PYX_ERR(0, 29, __pyx_L3_error)
2678  }
2679  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
2680  goto __pyx_L5_argtuple_error;
2681  } else {
2682  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2683  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2684  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2685  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
2686  }
2687  __pyx_v_nElementBoundaries_global = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_nElementBoundaries_global == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 29, __pyx_L3_error)
2688  __pyx_v_elementBoundaryElementsArray = ((PyArrayObject *)values[1]);
2689  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[2]);
2690  __pyx_v_elementBoundaryMaterialTypes = ((PyArrayObject *)values[3]);
2691  }
2692  goto __pyx_L4_argument_unpacking_done;
2693  __pyx_L5_argtuple_error:;
2694  __Pyx_RaiseArgtupleInvalid("setElementBoundariesArray", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 29, __pyx_L3_error)
2695  __pyx_L3_error:;
2696  __Pyx_AddTraceback("subsurfaceTransportFunctions.setElementBoundariesArray", __pyx_clineno, __pyx_lineno, __pyx_filename);
2697  __Pyx_RefNannyFinishContext();
2698  return NULL;
2699  __pyx_L4_argument_unpacking_done:;
2700  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryElementsArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryElementsArray", 0))) __PYX_ERR(0, 30, __pyx_L1_error)
2701  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) __PYX_ERR(0, 31, __pyx_L1_error)
2702  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryMaterialTypes", 0))) __PYX_ERR(0, 32, __pyx_L1_error)
2703  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_2setElementBoundariesArray(__pyx_self, __pyx_v_nElementBoundaries_global, __pyx_v_elementBoundaryElementsArray, __pyx_v_elementMaterialTypes, __pyx_v_elementBoundaryMaterialTypes);
2704 
2705  /* function exit code */
2706  goto __pyx_L0;
2707  __pyx_L1_error:;
2708  __pyx_r = NULL;
2709  __pyx_L0:;
2710  __Pyx_RefNannyFinishContext();
2711  return __pyx_r;
2712 }
2713 
2714 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_2setElementBoundariesArray(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nElementBoundaries_global, PyArrayObject *__pyx_v_elementBoundaryElementsArray, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_elementBoundaryMaterialTypes) {
2715  int __pyx_v_ebN;
2716  int __pyx_v_eN_left;
2717  int __pyx_v_eN_right;
2718  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryElementsArray;
2719  __Pyx_Buffer __pyx_pybuffer_elementBoundaryElementsArray;
2720  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryMaterialTypes;
2721  __Pyx_Buffer __pyx_pybuffer_elementBoundaryMaterialTypes;
2722  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
2723  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
2724  PyObject *__pyx_r = NULL;
2725  __Pyx_RefNannyDeclarations
2726  int __pyx_t_1;
2727  int __pyx_t_2;
2728  int __pyx_t_3;
2729  Py_ssize_t __pyx_t_4;
2730  Py_ssize_t __pyx_t_5;
2731  int __pyx_t_6;
2732  Py_ssize_t __pyx_t_7;
2733  int __pyx_t_8;
2734  int __pyx_lineno = 0;
2735  const char *__pyx_filename = NULL;
2736  int __pyx_clineno = 0;
2737  __Pyx_RefNannySetupContext("setElementBoundariesArray", 0);
2738  __pyx_pybuffer_elementBoundaryElementsArray.pybuffer.buf = NULL;
2739  __pyx_pybuffer_elementBoundaryElementsArray.refcount = 0;
2740  __pyx_pybuffernd_elementBoundaryElementsArray.data = NULL;
2741  __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer = &__pyx_pybuffer_elementBoundaryElementsArray;
2742  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
2743  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
2744  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
2745  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
2746  __pyx_pybuffer_elementBoundaryMaterialTypes.pybuffer.buf = NULL;
2747  __pyx_pybuffer_elementBoundaryMaterialTypes.refcount = 0;
2748  __pyx_pybuffernd_elementBoundaryMaterialTypes.data = NULL;
2749  __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryMaterialTypes;
2750  {
2751  __Pyx_BufFmt_StackElem __pyx_stack[1];
2752  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryElementsArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 29, __pyx_L1_error)
2753  }
2754  __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.shape[1];
2755  {
2756  __Pyx_BufFmt_StackElem __pyx_stack[1];
2757  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 29, __pyx_L1_error)
2758  }
2759  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
2760  {
2761  __Pyx_BufFmt_StackElem __pyx_stack[1];
2762  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 29, __pyx_L1_error)
2763  }
2764  __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer.shape[1];
2765 
2766  /* "subsurfaceTransportFunctions.pyx":34
2767  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryMaterialTypes):
2768  * cdef int ebN,eN_left,eN_right
2769  * for ebN in range(nElementBoundaries_global): # <<<<<<<<<<<<<<
2770  * eN_left = elementBoundaryElementsArray[ebN,0]
2771  * eN_right= elementBoundaryElementsArray[ebN,1]
2772  */
2773  __pyx_t_1 = __pyx_v_nElementBoundaries_global;
2774  __pyx_t_2 = __pyx_t_1;
2775  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
2776  __pyx_v_ebN = __pyx_t_3;
2777 
2778  /* "subsurfaceTransportFunctions.pyx":35
2779  * cdef int ebN,eN_left,eN_right
2780  * for ebN in range(nElementBoundaries_global):
2781  * eN_left = elementBoundaryElementsArray[ebN,0] # <<<<<<<<<<<<<<
2782  * eN_right= elementBoundaryElementsArray[ebN,1]
2783  * elementBoundaryMaterialTypes[ebN,0] = elementMaterialTypes[eN_left]
2784  */
2785  __pyx_t_4 = __pyx_v_ebN;
2786  __pyx_t_5 = 0;
2787  __pyx_t_6 = -1;
2788  if (__pyx_t_4 < 0) {
2789  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape;
2790  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 0;
2791  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape)) __pyx_t_6 = 0;
2792  if (__pyx_t_5 < 0) {
2793  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape;
2794  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 1;
2795  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape)) __pyx_t_6 = 1;
2796  if (unlikely(__pyx_t_6 != -1)) {
2797  __Pyx_RaiseBufferIndexError(__pyx_t_6);
2798  __PYX_ERR(0, 35, __pyx_L1_error)
2799  }
2800  __pyx_v_eN_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].strides, __pyx_t_5, __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].strides));
2801 
2802  /* "subsurfaceTransportFunctions.pyx":36
2803  * for ebN in range(nElementBoundaries_global):
2804  * eN_left = elementBoundaryElementsArray[ebN,0]
2805  * eN_right= elementBoundaryElementsArray[ebN,1] # <<<<<<<<<<<<<<
2806  * elementBoundaryMaterialTypes[ebN,0] = elementMaterialTypes[eN_left]
2807  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_left]
2808  */
2809  __pyx_t_5 = __pyx_v_ebN;
2810  __pyx_t_4 = 1;
2811  __pyx_t_6 = -1;
2812  if (__pyx_t_5 < 0) {
2813  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape;
2814  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 0;
2815  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].shape)) __pyx_t_6 = 0;
2816  if (__pyx_t_4 < 0) {
2817  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape;
2818  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 1;
2819  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].shape)) __pyx_t_6 = 1;
2820  if (unlikely(__pyx_t_6 != -1)) {
2821  __Pyx_RaiseBufferIndexError(__pyx_t_6);
2822  __PYX_ERR(0, 36, __pyx_L1_error)
2823  }
2824  __pyx_v_eN_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[0].strides, __pyx_t_4, __pyx_pybuffernd_elementBoundaryElementsArray.diminfo[1].strides));
2825 
2826  /* "subsurfaceTransportFunctions.pyx":37
2827  * eN_left = elementBoundaryElementsArray[ebN,0]
2828  * eN_right= elementBoundaryElementsArray[ebN,1]
2829  * elementBoundaryMaterialTypes[ebN,0] = elementMaterialTypes[eN_left] # <<<<<<<<<<<<<<
2830  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_left]
2831  * if eN_right >= 0:
2832  */
2833  __pyx_t_4 = __pyx_v_eN_left;
2834  __pyx_t_6 = -1;
2835  if (__pyx_t_4 < 0) {
2836  __pyx_t_4 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
2837  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 0;
2838  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_6 = 0;
2839  if (unlikely(__pyx_t_6 != -1)) {
2840  __Pyx_RaiseBufferIndexError(__pyx_t_6);
2841  __PYX_ERR(0, 37, __pyx_L1_error)
2842  }
2843  __pyx_t_5 = __pyx_v_ebN;
2844  __pyx_t_7 = 0;
2845  __pyx_t_6 = -1;
2846  if (__pyx_t_5 < 0) {
2847  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].shape;
2848  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 0;
2849  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].shape)) __pyx_t_6 = 0;
2850  if (__pyx_t_7 < 0) {
2851  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].shape;
2852  if (unlikely(__pyx_t_7 < 0)) __pyx_t_6 = 1;
2853  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].shape)) __pyx_t_6 = 1;
2854  if (unlikely(__pyx_t_6 != -1)) {
2855  __Pyx_RaiseBufferIndexError(__pyx_t_6);
2856  __PYX_ERR(0, 37, __pyx_L1_error)
2857  }
2858  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
2859 
2860  /* "subsurfaceTransportFunctions.pyx":38
2861  * eN_right= elementBoundaryElementsArray[ebN,1]
2862  * elementBoundaryMaterialTypes[ebN,0] = elementMaterialTypes[eN_left]
2863  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_left] # <<<<<<<<<<<<<<
2864  * if eN_right >= 0:
2865  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_right]
2866  */
2867  __pyx_t_4 = __pyx_v_eN_left;
2868  __pyx_t_6 = -1;
2869  if (__pyx_t_4 < 0) {
2870  __pyx_t_4 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
2871  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 0;
2872  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_6 = 0;
2873  if (unlikely(__pyx_t_6 != -1)) {
2874  __Pyx_RaiseBufferIndexError(__pyx_t_6);
2875  __PYX_ERR(0, 38, __pyx_L1_error)
2876  }
2877  __pyx_t_7 = __pyx_v_ebN;
2878  __pyx_t_5 = 1;
2879  __pyx_t_6 = -1;
2880  if (__pyx_t_7 < 0) {
2881  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].shape;
2882  if (unlikely(__pyx_t_7 < 0)) __pyx_t_6 = 0;
2883  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].shape)) __pyx_t_6 = 0;
2884  if (__pyx_t_5 < 0) {
2885  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].shape;
2886  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 1;
2887  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].shape)) __pyx_t_6 = 1;
2888  if (unlikely(__pyx_t_6 != -1)) {
2889  __Pyx_RaiseBufferIndexError(__pyx_t_6);
2890  __PYX_ERR(0, 38, __pyx_L1_error)
2891  }
2892  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].strides, __pyx_t_5, __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
2893 
2894  /* "subsurfaceTransportFunctions.pyx":39
2895  * elementBoundaryMaterialTypes[ebN,0] = elementMaterialTypes[eN_left]
2896  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_left]
2897  * if eN_right >= 0: # <<<<<<<<<<<<<<
2898  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_right]
2899  *
2900  */
2901  __pyx_t_8 = ((__pyx_v_eN_right >= 0) != 0);
2902  if (__pyx_t_8) {
2903 
2904  /* "subsurfaceTransportFunctions.pyx":40
2905  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_left]
2906  * if eN_right >= 0:
2907  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_right] # <<<<<<<<<<<<<<
2908  *
2909  * ###
2910  */
2911  __pyx_t_4 = __pyx_v_eN_right;
2912  __pyx_t_6 = -1;
2913  if (__pyx_t_4 < 0) {
2914  __pyx_t_4 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
2915  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 0;
2916  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_6 = 0;
2917  if (unlikely(__pyx_t_6 != -1)) {
2918  __Pyx_RaiseBufferIndexError(__pyx_t_6);
2919  __PYX_ERR(0, 40, __pyx_L1_error)
2920  }
2921  __pyx_t_5 = __pyx_v_ebN;
2922  __pyx_t_7 = 1;
2923  __pyx_t_6 = -1;
2924  if (__pyx_t_5 < 0) {
2925  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].shape;
2926  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 0;
2927  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].shape)) __pyx_t_6 = 0;
2928  if (__pyx_t_7 < 0) {
2929  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].shape;
2930  if (unlikely(__pyx_t_7 < 0)) __pyx_t_6 = 1;
2931  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].shape)) __pyx_t_6 = 1;
2932  if (unlikely(__pyx_t_6 != -1)) {
2933  __Pyx_RaiseBufferIndexError(__pyx_t_6);
2934  __PYX_ERR(0, 40, __pyx_L1_error)
2935  }
2936  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_elementBoundaryMaterialTypes.diminfo[1].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
2937 
2938  /* "subsurfaceTransportFunctions.pyx":39
2939  * elementBoundaryMaterialTypes[ebN,0] = elementMaterialTypes[eN_left]
2940  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_left]
2941  * if eN_right >= 0: # <<<<<<<<<<<<<<
2942  * elementBoundaryMaterialTypes[ebN,1] = elementMaterialTypes[eN_right]
2943  *
2944  */
2945  }
2946  }
2947 
2948  /* "subsurfaceTransportFunctions.pyx":29
2949  * exteriorElementBoundaryMaterialTypes[ebNE] = elementMaterialTypes[eN]
2950  *
2951  * def setElementBoundariesArray(int nElementBoundaries_global, # <<<<<<<<<<<<<<
2952  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
2953  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
2954  */
2955 
2956  /* function exit code */
2957  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2958  goto __pyx_L0;
2959  __pyx_L1_error:;
2960  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
2961  __Pyx_PyThreadState_declare
2962  __Pyx_PyThreadState_assign
2963  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
2964  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer);
2965  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer);
2966  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
2967  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
2968  __Pyx_AddTraceback("subsurfaceTransportFunctions.setElementBoundariesArray", __pyx_clineno, __pyx_lineno, __pyx_filename);
2969  __pyx_r = NULL;
2970  goto __pyx_L2;
2971  __pyx_L0:;
2972  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryElementsArray.rcbuffer->pybuffer);
2973  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryMaterialTypes.rcbuffer->pybuffer);
2974  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
2975  __pyx_L2:;
2976  __Pyx_XGIVEREF(__pyx_r);
2977  __Pyx_RefNannyFinishContext();
2978  return __pyx_r;
2979 }
2980 
2981 /* "subsurfaceTransportFunctions.pyx":43
2982  *
2983  * ###
2984  * def setScalarMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
2985  * numpy.ndarray[DTYPE_t,ndim=2] q_vals,
2986  * dict material_functions):
2987  */
2988 
2989 /* Python wrapper */
2990 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_5setScalarMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2991 static char __pyx_doc_28subsurfaceTransportFunctions_4setScalarMaterialFunctionOverElements[] = "\n loop over quadrature array and set is material j\n likely little improvement right now without correct typing of material_functions\n ";
2992 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_5setScalarMaterialFunctionOverElements = {"setScalarMaterialFunctionOverElements", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_5setScalarMaterialFunctionOverElements, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_4setScalarMaterialFunctionOverElements};
2993 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_5setScalarMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2994  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
2995  PyArrayObject *__pyx_v_q_vals = 0;
2996  PyObject *__pyx_v_material_functions = 0;
2997  int __pyx_lineno = 0;
2998  const char *__pyx_filename = NULL;
2999  int __pyx_clineno = 0;
3000  PyObject *__pyx_r = 0;
3001  __Pyx_RefNannyDeclarations
3002  __Pyx_RefNannySetupContext("setScalarMaterialFunctionOverElements (wrapper)", 0);
3003  {
3004  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_q_vals,&__pyx_n_s_material_functions,0};
3005  PyObject* values[3] = {0,0,0};
3006  if (unlikely(__pyx_kwds)) {
3007  Py_ssize_t kw_args;
3008  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3009  switch (pos_args) {
3010  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3011  CYTHON_FALLTHROUGH;
3012  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3013  CYTHON_FALLTHROUGH;
3014  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3015  CYTHON_FALLTHROUGH;
3016  case 0: break;
3017  default: goto __pyx_L5_argtuple_error;
3018  }
3019  kw_args = PyDict_Size(__pyx_kwds);
3020  switch (pos_args) {
3021  case 0:
3022  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
3023  else goto __pyx_L5_argtuple_error;
3024  CYTHON_FALLTHROUGH;
3025  case 1:
3026  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_vals)) != 0)) kw_args--;
3027  else {
3028  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverElements", 1, 3, 3, 1); __PYX_ERR(0, 43, __pyx_L3_error)
3029  }
3030  CYTHON_FALLTHROUGH;
3031  case 2:
3032  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
3033  else {
3034  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverElements", 1, 3, 3, 2); __PYX_ERR(0, 43, __pyx_L3_error)
3035  }
3036  }
3037  if (unlikely(kw_args > 0)) {
3038  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setScalarMaterialFunctionOverElements") < 0)) __PYX_ERR(0, 43, __pyx_L3_error)
3039  }
3040  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
3041  goto __pyx_L5_argtuple_error;
3042  } else {
3043  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3044  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3045  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3046  }
3047  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[0]);
3048  __pyx_v_q_vals = ((PyArrayObject *)values[1]);
3049  __pyx_v_material_functions = ((PyObject*)values[2]);
3050  }
3051  goto __pyx_L4_argument_unpacking_done;
3052  __pyx_L5_argtuple_error:;
3053  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverElements", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 43, __pyx_L3_error)
3054  __pyx_L3_error:;
3055  __Pyx_AddTraceback("subsurfaceTransportFunctions.setScalarMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
3056  __Pyx_RefNannyFinishContext();
3057  return NULL;
3058  __pyx_L4_argument_unpacking_done:;
3059  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) __PYX_ERR(0, 43, __pyx_L1_error)
3060  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_vals), __pyx_ptype_5numpy_ndarray, 1, "q_vals", 0))) __PYX_ERR(0, 44, __pyx_L1_error)
3061  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 45, __pyx_L1_error)
3062  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_4setScalarMaterialFunctionOverElements(__pyx_self, __pyx_v_elementMaterialTypes, __pyx_v_q_vals, __pyx_v_material_functions);
3063 
3064  /* function exit code */
3065  goto __pyx_L0;
3066  __pyx_L1_error:;
3067  __pyx_r = NULL;
3068  __pyx_L0:;
3069  __Pyx_RefNannyFinishContext();
3070  return __pyx_r;
3071 }
3072 
3073 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_4setScalarMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions) {
3074  int __pyx_v_eN;
3075  int __pyx_v_k;
3076  int __pyx_v_material;
3077  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
3078  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
3079  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_vals;
3080  __Pyx_Buffer __pyx_pybuffer_q_vals;
3081  PyObject *__pyx_r = NULL;
3082  __Pyx_RefNannyDeclarations
3083  npy_intp __pyx_t_1;
3084  npy_intp __pyx_t_2;
3085  int __pyx_t_3;
3086  Py_ssize_t __pyx_t_4;
3087  int __pyx_t_5;
3088  npy_intp __pyx_t_6;
3089  npy_intp __pyx_t_7;
3090  PyObject *__pyx_t_8 = NULL;
3091  PyObject *__pyx_t_9 = NULL;
3092  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_10;
3093  Py_ssize_t __pyx_t_11;
3094  int __pyx_t_12;
3095  int __pyx_lineno = 0;
3096  const char *__pyx_filename = NULL;
3097  int __pyx_clineno = 0;
3098  __Pyx_RefNannySetupContext("setScalarMaterialFunctionOverElements", 0);
3099  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
3100  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
3101  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
3102  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
3103  __pyx_pybuffer_q_vals.pybuffer.buf = NULL;
3104  __pyx_pybuffer_q_vals.refcount = 0;
3105  __pyx_pybuffernd_q_vals.data = NULL;
3106  __pyx_pybuffernd_q_vals.rcbuffer = &__pyx_pybuffer_q_vals;
3107  {
3108  __Pyx_BufFmt_StackElem __pyx_stack[1];
3109  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 43, __pyx_L1_error)
3110  }
3111  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
3112  {
3113  __Pyx_BufFmt_StackElem __pyx_stack[1];
3114  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 43, __pyx_L1_error)
3115  }
3116  __pyx_pybuffernd_q_vals.diminfo[0].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_vals.diminfo[0].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_vals.diminfo[1].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_vals.diminfo[1].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[1];
3117 
3118  /* "subsurfaceTransportFunctions.pyx":51
3119  * """
3120  * cdef int eN,k,material
3121  * for eN in range(q_vals.shape[0]): # <<<<<<<<<<<<<<
3122  * material = elementMaterialTypes[eN]
3123  * for k in range(q_vals.shape[1]):
3124  */
3125  __pyx_t_1 = (__pyx_v_q_vals->dimensions[0]);
3126  __pyx_t_2 = __pyx_t_1;
3127  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
3128  __pyx_v_eN = __pyx_t_3;
3129 
3130  /* "subsurfaceTransportFunctions.pyx":52
3131  * cdef int eN,k,material
3132  * for eN in range(q_vals.shape[0]):
3133  * material = elementMaterialTypes[eN] # <<<<<<<<<<<<<<
3134  * for k in range(q_vals.shape[1]):
3135  * q_vals[eN,k] = material_functions[material]
3136  */
3137  __pyx_t_4 = __pyx_v_eN;
3138  __pyx_t_5 = -1;
3139  if (__pyx_t_4 < 0) {
3140  __pyx_t_4 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
3141  if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
3142  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_5 = 0;
3143  if (unlikely(__pyx_t_5 != -1)) {
3144  __Pyx_RaiseBufferIndexError(__pyx_t_5);
3145  __PYX_ERR(0, 52, __pyx_L1_error)
3146  }
3147  __pyx_v_material = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
3148 
3149  /* "subsurfaceTransportFunctions.pyx":53
3150  * for eN in range(q_vals.shape[0]):
3151  * material = elementMaterialTypes[eN]
3152  * for k in range(q_vals.shape[1]): # <<<<<<<<<<<<<<
3153  * q_vals[eN,k] = material_functions[material]
3154  *
3155  */
3156  __pyx_t_6 = (__pyx_v_q_vals->dimensions[1]);
3157  __pyx_t_7 = __pyx_t_6;
3158  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_7; __pyx_t_5+=1) {
3159  __pyx_v_k = __pyx_t_5;
3160 
3161  /* "subsurfaceTransportFunctions.pyx":54
3162  * material = elementMaterialTypes[eN]
3163  * for k in range(q_vals.shape[1]):
3164  * q_vals[eN,k] = material_functions[material] # <<<<<<<<<<<<<<
3165  *
3166  * def setVectorMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
3167  */
3168  if (unlikely(__pyx_v_material_functions == Py_None)) {
3169  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
3170  __PYX_ERR(0, 54, __pyx_L1_error)
3171  }
3172  __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_material); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 54, __pyx_L1_error)
3173  __Pyx_GOTREF(__pyx_t_8);
3174  __pyx_t_9 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 54, __pyx_L1_error)
3175  __Pyx_GOTREF(__pyx_t_9);
3176  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3177  __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_9); if (unlikely((__pyx_t_10 == ((npy_double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 54, __pyx_L1_error)
3178  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
3179  __pyx_t_4 = __pyx_v_eN;
3180  __pyx_t_11 = __pyx_v_k;
3181  __pyx_t_12 = -1;
3182  if (__pyx_t_4 < 0) {
3183  __pyx_t_4 += __pyx_pybuffernd_q_vals.diminfo[0].shape;
3184  if (unlikely(__pyx_t_4 < 0)) __pyx_t_12 = 0;
3185  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_q_vals.diminfo[0].shape)) __pyx_t_12 = 0;
3186  if (__pyx_t_11 < 0) {
3187  __pyx_t_11 += __pyx_pybuffernd_q_vals.diminfo[1].shape;
3188  if (unlikely(__pyx_t_11 < 0)) __pyx_t_12 = 1;
3189  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_q_vals.diminfo[1].shape)) __pyx_t_12 = 1;
3190  if (unlikely(__pyx_t_12 != -1)) {
3191  __Pyx_RaiseBufferIndexError(__pyx_t_12);
3192  __PYX_ERR(0, 54, __pyx_L1_error)
3193  }
3194  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_q_vals.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_q_vals.diminfo[1].strides) = __pyx_t_10;
3195  }
3196  }
3197 
3198  /* "subsurfaceTransportFunctions.pyx":43
3199  *
3200  * ###
3201  * def setScalarMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
3202  * numpy.ndarray[DTYPE_t,ndim=2] q_vals,
3203  * dict material_functions):
3204  */
3205 
3206  /* function exit code */
3207  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3208  goto __pyx_L0;
3209  __pyx_L1_error:;
3210  __Pyx_XDECREF(__pyx_t_8);
3211  __Pyx_XDECREF(__pyx_t_9);
3212  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
3213  __Pyx_PyThreadState_declare
3214  __Pyx_PyThreadState_assign
3215  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
3216  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
3217  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
3218  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
3219  __Pyx_AddTraceback("subsurfaceTransportFunctions.setScalarMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
3220  __pyx_r = NULL;
3221  goto __pyx_L2;
3222  __pyx_L0:;
3223  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
3224  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
3225  __pyx_L2:;
3226  __Pyx_XGIVEREF(__pyx_r);
3227  __Pyx_RefNannyFinishContext();
3228  return __pyx_r;
3229 }
3230 
3231 /* "subsurfaceTransportFunctions.pyx":56
3232  * q_vals[eN,k] = material_functions[material]
3233  *
3234  * def setVectorMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
3235  * numpy.ndarray[DTYPE_t,ndim=3] q_vals,
3236  * dict material_functions):
3237  */
3238 
3239 /* Python wrapper */
3240 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_7setVectorMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3241 static char __pyx_doc_28subsurfaceTransportFunctions_6setVectorMaterialFunctionOverElements[] = "\n loop over quadrature array and set \013ec f_j assuming element is material j\n ";
3242 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_7setVectorMaterialFunctionOverElements = {"setVectorMaterialFunctionOverElements", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_7setVectorMaterialFunctionOverElements, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_6setVectorMaterialFunctionOverElements};
3243 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_7setVectorMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3244  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
3245  PyArrayObject *__pyx_v_q_vals = 0;
3246  PyObject *__pyx_v_material_functions = 0;
3247  int __pyx_lineno = 0;
3248  const char *__pyx_filename = NULL;
3249  int __pyx_clineno = 0;
3250  PyObject *__pyx_r = 0;
3251  __Pyx_RefNannyDeclarations
3252  __Pyx_RefNannySetupContext("setVectorMaterialFunctionOverElements (wrapper)", 0);
3253  {
3254  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_q_vals,&__pyx_n_s_material_functions,0};
3255  PyObject* values[3] = {0,0,0};
3256  if (unlikely(__pyx_kwds)) {
3257  Py_ssize_t kw_args;
3258  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3259  switch (pos_args) {
3260  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3261  CYTHON_FALLTHROUGH;
3262  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3263  CYTHON_FALLTHROUGH;
3264  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3265  CYTHON_FALLTHROUGH;
3266  case 0: break;
3267  default: goto __pyx_L5_argtuple_error;
3268  }
3269  kw_args = PyDict_Size(__pyx_kwds);
3270  switch (pos_args) {
3271  case 0:
3272  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
3273  else goto __pyx_L5_argtuple_error;
3274  CYTHON_FALLTHROUGH;
3275  case 1:
3276  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_vals)) != 0)) kw_args--;
3277  else {
3278  __Pyx_RaiseArgtupleInvalid("setVectorMaterialFunctionOverElements", 1, 3, 3, 1); __PYX_ERR(0, 56, __pyx_L3_error)
3279  }
3280  CYTHON_FALLTHROUGH;
3281  case 2:
3282  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
3283  else {
3284  __Pyx_RaiseArgtupleInvalid("setVectorMaterialFunctionOverElements", 1, 3, 3, 2); __PYX_ERR(0, 56, __pyx_L3_error)
3285  }
3286  }
3287  if (unlikely(kw_args > 0)) {
3288  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setVectorMaterialFunctionOverElements") < 0)) __PYX_ERR(0, 56, __pyx_L3_error)
3289  }
3290  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
3291  goto __pyx_L5_argtuple_error;
3292  } else {
3293  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3294  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3295  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3296  }
3297  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[0]);
3298  __pyx_v_q_vals = ((PyArrayObject *)values[1]);
3299  __pyx_v_material_functions = ((PyObject*)values[2]);
3300  }
3301  goto __pyx_L4_argument_unpacking_done;
3302  __pyx_L5_argtuple_error:;
3303  __Pyx_RaiseArgtupleInvalid("setVectorMaterialFunctionOverElements", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 56, __pyx_L3_error)
3304  __pyx_L3_error:;
3305  __Pyx_AddTraceback("subsurfaceTransportFunctions.setVectorMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
3306  __Pyx_RefNannyFinishContext();
3307  return NULL;
3308  __pyx_L4_argument_unpacking_done:;
3309  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) __PYX_ERR(0, 56, __pyx_L1_error)
3310  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_vals), __pyx_ptype_5numpy_ndarray, 1, "q_vals", 0))) __PYX_ERR(0, 57, __pyx_L1_error)
3311  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 58, __pyx_L1_error)
3312  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_6setVectorMaterialFunctionOverElements(__pyx_self, __pyx_v_elementMaterialTypes, __pyx_v_q_vals, __pyx_v_material_functions);
3313 
3314  /* function exit code */
3315  goto __pyx_L0;
3316  __pyx_L1_error:;
3317  __pyx_r = NULL;
3318  __pyx_L0:;
3319  __Pyx_RefNannyFinishContext();
3320  return __pyx_r;
3321 }
3322 
3323 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_6setVectorMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions) {
3324  int __pyx_v_eN;
3325  int __pyx_v_k;
3326  int __pyx_v_material;
3327  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
3328  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
3329  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_vals;
3330  __Pyx_Buffer __pyx_pybuffer_q_vals;
3331  PyObject *__pyx_r = NULL;
3332  __Pyx_RefNannyDeclarations
3333  npy_intp __pyx_t_1;
3334  npy_intp __pyx_t_2;
3335  int __pyx_t_3;
3336  Py_ssize_t __pyx_t_4;
3337  int __pyx_t_5;
3338  npy_intp __pyx_t_6;
3339  npy_intp __pyx_t_7;
3340  PyObject *__pyx_t_8 = NULL;
3341  PyObject *__pyx_t_9 = NULL;
3342  PyObject *__pyx_t_10 = NULL;
3343  PyObject *__pyx_t_11 = NULL;
3344  int __pyx_lineno = 0;
3345  const char *__pyx_filename = NULL;
3346  int __pyx_clineno = 0;
3347  __Pyx_RefNannySetupContext("setVectorMaterialFunctionOverElements", 0);
3348  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
3349  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
3350  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
3351  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
3352  __pyx_pybuffer_q_vals.pybuffer.buf = NULL;
3353  __pyx_pybuffer_q_vals.refcount = 0;
3354  __pyx_pybuffernd_q_vals.data = NULL;
3355  __pyx_pybuffernd_q_vals.rcbuffer = &__pyx_pybuffer_q_vals;
3356  {
3357  __Pyx_BufFmt_StackElem __pyx_stack[1];
3358  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 56, __pyx_L1_error)
3359  }
3360  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
3361  {
3362  __Pyx_BufFmt_StackElem __pyx_stack[1];
3363  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 56, __pyx_L1_error)
3364  }
3365  __pyx_pybuffernd_q_vals.diminfo[0].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_vals.diminfo[0].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_vals.diminfo[1].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_vals.diminfo[1].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_vals.diminfo[2].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_vals.diminfo[2].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[2];
3366 
3367  /* "subsurfaceTransportFunctions.pyx":63
3368  * """
3369  * cdef int eN,k,material
3370  * for eN in range(q_vals.shape[0]): # <<<<<<<<<<<<<<
3371  * material = elementMaterialTypes[eN]
3372  * for k in range(q_vals.shape[1]):
3373  */
3374  __pyx_t_1 = (__pyx_v_q_vals->dimensions[0]);
3375  __pyx_t_2 = __pyx_t_1;
3376  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
3377  __pyx_v_eN = __pyx_t_3;
3378 
3379  /* "subsurfaceTransportFunctions.pyx":64
3380  * cdef int eN,k,material
3381  * for eN in range(q_vals.shape[0]):
3382  * material = elementMaterialTypes[eN] # <<<<<<<<<<<<<<
3383  * for k in range(q_vals.shape[1]):
3384  * q_vals[eN,k,:] = material_functions[material].flat
3385  */
3386  __pyx_t_4 = __pyx_v_eN;
3387  __pyx_t_5 = -1;
3388  if (__pyx_t_4 < 0) {
3389  __pyx_t_4 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
3390  if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
3391  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_5 = 0;
3392  if (unlikely(__pyx_t_5 != -1)) {
3393  __Pyx_RaiseBufferIndexError(__pyx_t_5);
3394  __PYX_ERR(0, 64, __pyx_L1_error)
3395  }
3396  __pyx_v_material = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
3397 
3398  /* "subsurfaceTransportFunctions.pyx":65
3399  * for eN in range(q_vals.shape[0]):
3400  * material = elementMaterialTypes[eN]
3401  * for k in range(q_vals.shape[1]): # <<<<<<<<<<<<<<
3402  * q_vals[eN,k,:] = material_functions[material].flat
3403  *
3404  */
3405  __pyx_t_6 = (__pyx_v_q_vals->dimensions[1]);
3406  __pyx_t_7 = __pyx_t_6;
3407  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_7; __pyx_t_5+=1) {
3408  __pyx_v_k = __pyx_t_5;
3409 
3410  /* "subsurfaceTransportFunctions.pyx":66
3411  * material = elementMaterialTypes[eN]
3412  * for k in range(q_vals.shape[1]):
3413  * q_vals[eN,k,:] = material_functions[material].flat # <<<<<<<<<<<<<<
3414  *
3415  *
3416  */
3417  if (unlikely(__pyx_v_material_functions == Py_None)) {
3418  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
3419  __PYX_ERR(0, 66, __pyx_L1_error)
3420  }
3421  __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_material); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 66, __pyx_L1_error)
3422  __Pyx_GOTREF(__pyx_t_8);
3423  __pyx_t_9 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 66, __pyx_L1_error)
3424  __Pyx_GOTREF(__pyx_t_9);
3425  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3426  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_flat); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 66, __pyx_L1_error)
3427  __Pyx_GOTREF(__pyx_t_8);
3428  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
3429  __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 66, __pyx_L1_error)
3430  __Pyx_GOTREF(__pyx_t_9);
3431  __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 66, __pyx_L1_error)
3432  __Pyx_GOTREF(__pyx_t_10);
3433  __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 66, __pyx_L1_error)
3434  __Pyx_GOTREF(__pyx_t_11);
3435  __Pyx_GIVEREF(__pyx_t_9);
3436  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9);
3437  __Pyx_GIVEREF(__pyx_t_10);
3438  PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_10);
3439  __Pyx_INCREF(__pyx_slice_);
3440  __Pyx_GIVEREF(__pyx_slice_);
3441  PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_slice_);
3442  __pyx_t_9 = 0;
3443  __pyx_t_10 = 0;
3444  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_q_vals), __pyx_t_11, __pyx_t_8) < 0)) __PYX_ERR(0, 66, __pyx_L1_error)
3445  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
3446  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3447  }
3448  }
3449 
3450  /* "subsurfaceTransportFunctions.pyx":56
3451  * q_vals[eN,k] = material_functions[material]
3452  *
3453  * def setVectorMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
3454  * numpy.ndarray[DTYPE_t,ndim=3] q_vals,
3455  * dict material_functions):
3456  */
3457 
3458  /* function exit code */
3459  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3460  goto __pyx_L0;
3461  __pyx_L1_error:;
3462  __Pyx_XDECREF(__pyx_t_8);
3463  __Pyx_XDECREF(__pyx_t_9);
3464  __Pyx_XDECREF(__pyx_t_10);
3465  __Pyx_XDECREF(__pyx_t_11);
3466  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
3467  __Pyx_PyThreadState_declare
3468  __Pyx_PyThreadState_assign
3469  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
3470  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
3471  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
3472  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
3473  __Pyx_AddTraceback("subsurfaceTransportFunctions.setVectorMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
3474  __pyx_r = NULL;
3475  goto __pyx_L2;
3476  __pyx_L0:;
3477  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
3478  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
3479  __pyx_L2:;
3480  __Pyx_XGIVEREF(__pyx_r);
3481  __Pyx_RefNannyFinishContext();
3482  return __pyx_r;
3483 }
3484 
3485 /* "subsurfaceTransportFunctions.pyx":69
3486  *
3487  *
3488  * def setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
3489  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
3490  * numpy.ndarray[DTYPE_t,ndim=3] ebq_vals,
3491  */
3492 
3493 /* Python wrapper */
3494 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_9setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3495 static char __pyx_doc_28subsurfaceTransportFunctions_8setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage[] = "\n loop over quadrature array and set f = 0.5(f^L_j+f^R_k) assuming element on left \n is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
3496 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_9setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage = {"setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_9setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_8setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage};
3497 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_9setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3498  PyArrayObject *__pyx_v_elementBoundariesArray = 0;
3499  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
3500  PyArrayObject *__pyx_v_ebq_vals = 0;
3501  PyObject *__pyx_v_material_functions = 0;
3502  int __pyx_lineno = 0;
3503  const char *__pyx_filename = NULL;
3504  int __pyx_clineno = 0;
3505  PyObject *__pyx_r = 0;
3506  __Pyx_RefNannyDeclarations
3507  __Pyx_RefNannySetupContext("setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage (wrapper)", 0);
3508  {
3509  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_ebq_vals,&__pyx_n_s_material_functions,0};
3510  PyObject* values[4] = {0,0,0,0};
3511  if (unlikely(__pyx_kwds)) {
3512  Py_ssize_t kw_args;
3513  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3514  switch (pos_args) {
3515  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3516  CYTHON_FALLTHROUGH;
3517  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3518  CYTHON_FALLTHROUGH;
3519  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3520  CYTHON_FALLTHROUGH;
3521  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3522  CYTHON_FALLTHROUGH;
3523  case 0: break;
3524  default: goto __pyx_L5_argtuple_error;
3525  }
3526  kw_args = PyDict_Size(__pyx_kwds);
3527  switch (pos_args) {
3528  case 0:
3529  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
3530  else goto __pyx_L5_argtuple_error;
3531  CYTHON_FALLTHROUGH;
3532  case 1:
3533  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
3534  else {
3535  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 4, 4, 1); __PYX_ERR(0, 69, __pyx_L3_error)
3536  }
3537  CYTHON_FALLTHROUGH;
3538  case 2:
3539  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ebq_vals)) != 0)) kw_args--;
3540  else {
3541  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 4, 4, 2); __PYX_ERR(0, 69, __pyx_L3_error)
3542  }
3543  CYTHON_FALLTHROUGH;
3544  case 3:
3545  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
3546  else {
3547  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 4, 4, 3); __PYX_ERR(0, 69, __pyx_L3_error)
3548  }
3549  }
3550  if (unlikely(kw_args > 0)) {
3551  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage") < 0)) __PYX_ERR(0, 69, __pyx_L3_error)
3552  }
3553  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
3554  goto __pyx_L5_argtuple_error;
3555  } else {
3556  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3557  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3558  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3559  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3560  }
3561  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[0]);
3562  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[1]);
3563  __pyx_v_ebq_vals = ((PyArrayObject *)values[2]);
3564  __pyx_v_material_functions = ((PyObject*)values[3]);
3565  }
3566  goto __pyx_L4_argument_unpacking_done;
3567  __pyx_L5_argtuple_error:;
3568  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 69, __pyx_L3_error)
3569  __pyx_L3_error:;
3570  __Pyx_AddTraceback("subsurfaceTransportFunctions.setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
3571  __Pyx_RefNannyFinishContext();
3572  return NULL;
3573  __pyx_L4_argument_unpacking_done:;
3574  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) __PYX_ERR(0, 69, __pyx_L1_error)
3575  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) __PYX_ERR(0, 70, __pyx_L1_error)
3576  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_vals", 0))) __PYX_ERR(0, 71, __pyx_L1_error)
3577  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 72, __pyx_L1_error)
3578  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_8setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(__pyx_self, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_ebq_vals, __pyx_v_material_functions);
3579 
3580  /* function exit code */
3581  goto __pyx_L0;
3582  __pyx_L1_error:;
3583  __pyx_r = NULL;
3584  __pyx_L0:;
3585  __Pyx_RefNannyFinishContext();
3586  return __pyx_r;
3587 }
3588 
3589 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_8setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions) {
3590  int __pyx_v_eN;
3591  int __pyx_v_ebN;
3592  int __pyx_v_ebN_local;
3593  int __pyx_v_k;
3594  int __pyx_v_material_left;
3595  int __pyx_v_material_right;
3596  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_vals;
3597  __Pyx_Buffer __pyx_pybuffer_ebq_vals;
3598  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
3599  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
3600  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
3601  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
3602  PyObject *__pyx_r = NULL;
3603  __Pyx_RefNannyDeclarations
3604  npy_intp __pyx_t_1;
3605  npy_intp __pyx_t_2;
3606  int __pyx_t_3;
3607  npy_intp __pyx_t_4;
3608  npy_intp __pyx_t_5;
3609  int __pyx_t_6;
3610  Py_ssize_t __pyx_t_7;
3611  Py_ssize_t __pyx_t_8;
3612  int __pyx_t_9;
3613  npy_intp __pyx_t_10;
3614  npy_intp __pyx_t_11;
3615  PyObject *__pyx_t_12 = NULL;
3616  PyObject *__pyx_t_13 = NULL;
3617  PyObject *__pyx_t_14 = NULL;
3618  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_15;
3619  Py_ssize_t __pyx_t_16;
3620  int __pyx_t_17;
3621  int __pyx_lineno = 0;
3622  const char *__pyx_filename = NULL;
3623  int __pyx_clineno = 0;
3624  __Pyx_RefNannySetupContext("setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 0);
3625  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
3626  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
3627  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
3628  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
3629  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
3630  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
3631  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
3632  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
3633  __pyx_pybuffer_ebq_vals.pybuffer.buf = NULL;
3634  __pyx_pybuffer_ebq_vals.refcount = 0;
3635  __pyx_pybuffernd_ebq_vals.data = NULL;
3636  __pyx_pybuffernd_ebq_vals.rcbuffer = &__pyx_pybuffer_ebq_vals;
3637  {
3638  __Pyx_BufFmt_StackElem __pyx_stack[1];
3639  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 69, __pyx_L1_error)
3640  }
3641  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
3642  {
3643  __Pyx_BufFmt_StackElem __pyx_stack[1];
3644  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 69, __pyx_L1_error)
3645  }
3646  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
3647  {
3648  __Pyx_BufFmt_StackElem __pyx_stack[1];
3649  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 69, __pyx_L1_error)
3650  }
3651  __pyx_pybuffernd_ebq_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_ebq_vals.diminfo[2].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_ebq_vals.diminfo[2].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[2];
3652 
3653  /* "subsurfaceTransportFunctions.pyx":82
3654  * cdef int eN,ebN,ebN_local,k,material_left,material_right
3655  *
3656  * for eN in range(ebq_vals.shape[0]): # <<<<<<<<<<<<<<
3657  * for ebN_local in range(ebq_vals.shape[1]):
3658  * ebN = elementBoundariesArray[eN,ebN_local]
3659  */
3660  __pyx_t_1 = (__pyx_v_ebq_vals->dimensions[0]);
3661  __pyx_t_2 = __pyx_t_1;
3662  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
3663  __pyx_v_eN = __pyx_t_3;
3664 
3665  /* "subsurfaceTransportFunctions.pyx":83
3666  *
3667  * for eN in range(ebq_vals.shape[0]):
3668  * for ebN_local in range(ebq_vals.shape[1]): # <<<<<<<<<<<<<<
3669  * ebN = elementBoundariesArray[eN,ebN_local]
3670  * material_left = elementBoundaryTypes[ebN,0]
3671  */
3672  __pyx_t_4 = (__pyx_v_ebq_vals->dimensions[1]);
3673  __pyx_t_5 = __pyx_t_4;
3674  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
3675  __pyx_v_ebN_local = __pyx_t_6;
3676 
3677  /* "subsurfaceTransportFunctions.pyx":84
3678  * for eN in range(ebq_vals.shape[0]):
3679  * for ebN_local in range(ebq_vals.shape[1]):
3680  * ebN = elementBoundariesArray[eN,ebN_local] # <<<<<<<<<<<<<<
3681  * material_left = elementBoundaryTypes[ebN,0]
3682  * material_right= elementBoundaryTypes[ebN,1]
3683  */
3684  __pyx_t_7 = __pyx_v_eN;
3685  __pyx_t_8 = __pyx_v_ebN_local;
3686  __pyx_t_9 = -1;
3687  if (__pyx_t_7 < 0) {
3688  __pyx_t_7 += __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape;
3689  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
3690  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape)) __pyx_t_9 = 0;
3691  if (__pyx_t_8 < 0) {
3692  __pyx_t_8 += __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape;
3693  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
3694  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape)) __pyx_t_9 = 1;
3695  if (unlikely(__pyx_t_9 != -1)) {
3696  __Pyx_RaiseBufferIndexError(__pyx_t_9);
3697  __PYX_ERR(0, 84, __pyx_L1_error)
3698  }
3699  __pyx_v_ebN = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides));
3700 
3701  /* "subsurfaceTransportFunctions.pyx":85
3702  * for ebN_local in range(ebq_vals.shape[1]):
3703  * ebN = elementBoundariesArray[eN,ebN_local]
3704  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
3705  * material_right= elementBoundaryTypes[ebN,1]
3706  * for k in range(ebq_vals.shape[2]):
3707  */
3708  __pyx_t_8 = __pyx_v_ebN;
3709  __pyx_t_7 = 0;
3710  __pyx_t_9 = -1;
3711  if (__pyx_t_8 < 0) {
3712  __pyx_t_8 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
3713  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0;
3714  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_9 = 0;
3715  if (__pyx_t_7 < 0) {
3716  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
3717  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 1;
3718  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_9 = 1;
3719  if (unlikely(__pyx_t_9 != -1)) {
3720  __Pyx_RaiseBufferIndexError(__pyx_t_9);
3721  __PYX_ERR(0, 85, __pyx_L1_error)
3722  }
3723  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
3724 
3725  /* "subsurfaceTransportFunctions.pyx":86
3726  * ebN = elementBoundariesArray[eN,ebN_local]
3727  * material_left = elementBoundaryTypes[ebN,0]
3728  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
3729  * for k in range(ebq_vals.shape[2]):
3730  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left]+
3731  */
3732  __pyx_t_7 = __pyx_v_ebN;
3733  __pyx_t_8 = 1;
3734  __pyx_t_9 = -1;
3735  if (__pyx_t_7 < 0) {
3736  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
3737  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
3738  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_9 = 0;
3739  if (__pyx_t_8 < 0) {
3740  __pyx_t_8 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
3741  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
3742  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_9 = 1;
3743  if (unlikely(__pyx_t_9 != -1)) {
3744  __Pyx_RaiseBufferIndexError(__pyx_t_9);
3745  __PYX_ERR(0, 86, __pyx_L1_error)
3746  }
3747  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
3748 
3749  /* "subsurfaceTransportFunctions.pyx":87
3750  * material_left = elementBoundaryTypes[ebN,0]
3751  * material_right= elementBoundaryTypes[ebN,1]
3752  * for k in range(ebq_vals.shape[2]): # <<<<<<<<<<<<<<
3753  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left]+
3754  * material_functions[material_right])
3755  */
3756  __pyx_t_10 = (__pyx_v_ebq_vals->dimensions[2]);
3757  __pyx_t_11 = __pyx_t_10;
3758  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_11; __pyx_t_9+=1) {
3759  __pyx_v_k = __pyx_t_9;
3760 
3761  /* "subsurfaceTransportFunctions.pyx":88
3762  * material_right= elementBoundaryTypes[ebN,1]
3763  * for k in range(ebq_vals.shape[2]):
3764  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left]+ # <<<<<<<<<<<<<<
3765  * material_functions[material_right])
3766  *
3767  */
3768  if (unlikely(__pyx_v_material_functions == Py_None)) {
3769  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
3770  __PYX_ERR(0, 88, __pyx_L1_error)
3771  }
3772  __pyx_t_12 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 88, __pyx_L1_error)
3773  __Pyx_GOTREF(__pyx_t_12);
3774  __pyx_t_13 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 88, __pyx_L1_error)
3775  __Pyx_GOTREF(__pyx_t_13);
3776  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
3777 
3778  /* "subsurfaceTransportFunctions.pyx":89
3779  * for k in range(ebq_vals.shape[2]):
3780  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left]+
3781  * material_functions[material_right]) # <<<<<<<<<<<<<<
3782  *
3783  * def setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd,
3784  */
3785  if (unlikely(__pyx_v_material_functions == Py_None)) {
3786  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
3787  __PYX_ERR(0, 89, __pyx_L1_error)
3788  }
3789  __pyx_t_12 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 89, __pyx_L1_error)
3790  __Pyx_GOTREF(__pyx_t_12);
3791  __pyx_t_14 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_12); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 89, __pyx_L1_error)
3792  __Pyx_GOTREF(__pyx_t_14);
3793  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
3794 
3795  /* "subsurfaceTransportFunctions.pyx":88
3796  * material_right= elementBoundaryTypes[ebN,1]
3797  * for k in range(ebq_vals.shape[2]):
3798  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left]+ # <<<<<<<<<<<<<<
3799  * material_functions[material_right])
3800  *
3801  */
3802  __pyx_t_12 = PyNumber_Add(__pyx_t_13, __pyx_t_14); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 88, __pyx_L1_error)
3803  __Pyx_GOTREF(__pyx_t_12);
3804  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
3805  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
3806  __pyx_t_14 = PyNumber_Multiply(__pyx_float_0_5, __pyx_t_12); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 88, __pyx_L1_error)
3807  __Pyx_GOTREF(__pyx_t_14);
3808  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
3809  __pyx_t_15 = __pyx_PyFloat_AsDouble(__pyx_t_14); if (unlikely((__pyx_t_15 == ((npy_double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 88, __pyx_L1_error)
3810  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
3811  __pyx_t_8 = __pyx_v_eN;
3812  __pyx_t_7 = __pyx_v_ebN_local;
3813  __pyx_t_16 = __pyx_v_k;
3814  __pyx_t_17 = -1;
3815  if (__pyx_t_8 < 0) {
3816  __pyx_t_8 += __pyx_pybuffernd_ebq_vals.diminfo[0].shape;
3817  if (unlikely(__pyx_t_8 < 0)) __pyx_t_17 = 0;
3818  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_ebq_vals.diminfo[0].shape)) __pyx_t_17 = 0;
3819  if (__pyx_t_7 < 0) {
3820  __pyx_t_7 += __pyx_pybuffernd_ebq_vals.diminfo[1].shape;
3821  if (unlikely(__pyx_t_7 < 0)) __pyx_t_17 = 1;
3822  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_ebq_vals.diminfo[1].shape)) __pyx_t_17 = 1;
3823  if (__pyx_t_16 < 0) {
3824  __pyx_t_16 += __pyx_pybuffernd_ebq_vals.diminfo[2].shape;
3825  if (unlikely(__pyx_t_16 < 0)) __pyx_t_17 = 2;
3826  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_ebq_vals.diminfo[2].shape)) __pyx_t_17 = 2;
3827  if (unlikely(__pyx_t_17 != -1)) {
3828  __Pyx_RaiseBufferIndexError(__pyx_t_17);
3829  __PYX_ERR(0, 88, __pyx_L1_error)
3830  }
3831  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_ebq_vals.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_ebq_vals.diminfo[1].strides, __pyx_t_16, __pyx_pybuffernd_ebq_vals.diminfo[2].strides) = __pyx_t_15;
3832  }
3833  }
3834  }
3835 
3836  /* "subsurfaceTransportFunctions.pyx":69
3837  *
3838  *
3839  * def setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
3840  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
3841  * numpy.ndarray[DTYPE_t,ndim=3] ebq_vals,
3842  */
3843 
3844  /* function exit code */
3845  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3846  goto __pyx_L0;
3847  __pyx_L1_error:;
3848  __Pyx_XDECREF(__pyx_t_12);
3849  __Pyx_XDECREF(__pyx_t_13);
3850  __Pyx_XDECREF(__pyx_t_14);
3851  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
3852  __Pyx_PyThreadState_declare
3853  __Pyx_PyThreadState_assign
3854  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
3855  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
3856  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
3857  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
3858  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
3859  __Pyx_AddTraceback("subsurfaceTransportFunctions.setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
3860  __pyx_r = NULL;
3861  goto __pyx_L2;
3862  __pyx_L0:;
3863  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
3864  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
3865  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
3866  __pyx_L2:;
3867  __Pyx_XGIVEREF(__pyx_r);
3868  __Pyx_RefNannyFinishContext();
3869  return __pyx_r;
3870 }
3871 
3872 /* "subsurfaceTransportFunctions.pyx":91
3873  * material_functions[material_right])
3874  *
3875  * def setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
3876  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
3877  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
3878  */
3879 
3880 /* Python wrapper */
3881 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_11setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3882 static char __pyx_doc_28subsurfaceTransportFunctions_10setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage[] = "\n loop over quadrature array and evaluate function \ten f_{mn} = f^L_{j,mn} f^R_{k,mn}/(f^L_{j,mn}+f^R_{k,mn})\n assuming element on left is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
3883 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_11setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage = {"setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_11setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_10setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage};
3884 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_11setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3885  int __pyx_v_nd;
3886  PyArrayObject *__pyx_v_elementBoundariesArray = 0;
3887  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
3888  PyArrayObject *__pyx_v_ebq_vals = 0;
3889  PyObject *__pyx_v_material_functions = 0;
3890  int __pyx_lineno = 0;
3891  const char *__pyx_filename = NULL;
3892  int __pyx_clineno = 0;
3893  PyObject *__pyx_r = 0;
3894  __Pyx_RefNannyDeclarations
3895  __Pyx_RefNannySetupContext("setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage (wrapper)", 0);
3896  {
3897  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nd,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_ebq_vals,&__pyx_n_s_material_functions,0};
3898  PyObject* values[5] = {0,0,0,0,0};
3899  if (unlikely(__pyx_kwds)) {
3900  Py_ssize_t kw_args;
3901  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3902  switch (pos_args) {
3903  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3904  CYTHON_FALLTHROUGH;
3905  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3906  CYTHON_FALLTHROUGH;
3907  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3908  CYTHON_FALLTHROUGH;
3909  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3910  CYTHON_FALLTHROUGH;
3911  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3912  CYTHON_FALLTHROUGH;
3913  case 0: break;
3914  default: goto __pyx_L5_argtuple_error;
3915  }
3916  kw_args = PyDict_Size(__pyx_kwds);
3917  switch (pos_args) {
3918  case 0:
3919  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nd)) != 0)) kw_args--;
3920  else goto __pyx_L5_argtuple_error;
3921  CYTHON_FALLTHROUGH;
3922  case 1:
3923  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
3924  else {
3925  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 5, 5, 1); __PYX_ERR(0, 91, __pyx_L3_error)
3926  }
3927  CYTHON_FALLTHROUGH;
3928  case 2:
3929  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
3930  else {
3931  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 5, 5, 2); __PYX_ERR(0, 91, __pyx_L3_error)
3932  }
3933  CYTHON_FALLTHROUGH;
3934  case 3:
3935  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ebq_vals)) != 0)) kw_args--;
3936  else {
3937  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 5, 5, 3); __PYX_ERR(0, 91, __pyx_L3_error)
3938  }
3939  CYTHON_FALLTHROUGH;
3940  case 4:
3941  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
3942  else {
3943  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 5, 5, 4); __PYX_ERR(0, 91, __pyx_L3_error)
3944  }
3945  }
3946  if (unlikely(kw_args > 0)) {
3947  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage") < 0)) __PYX_ERR(0, 91, __pyx_L3_error)
3948  }
3949  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
3950  goto __pyx_L5_argtuple_error;
3951  } else {
3952  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3953  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3954  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3955  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3956  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3957  }
3958  __pyx_v_nd = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_nd == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 91, __pyx_L3_error)
3959  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[1]);
3960  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[2]);
3961  __pyx_v_ebq_vals = ((PyArrayObject *)values[3]);
3962  __pyx_v_material_functions = ((PyObject*)values[4]);
3963  }
3964  goto __pyx_L4_argument_unpacking_done;
3965  __pyx_L5_argtuple_error:;
3966  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 91, __pyx_L3_error)
3967  __pyx_L3_error:;
3968  __Pyx_AddTraceback("subsurfaceTransportFunctions.setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
3969  __Pyx_RefNannyFinishContext();
3970  return NULL;
3971  __pyx_L4_argument_unpacking_done:;
3972  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) __PYX_ERR(0, 92, __pyx_L1_error)
3973  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) __PYX_ERR(0, 93, __pyx_L1_error)
3974  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_vals", 0))) __PYX_ERR(0, 94, __pyx_L1_error)
3975  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 95, __pyx_L1_error)
3976  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_10setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(__pyx_self, __pyx_v_nd, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_ebq_vals, __pyx_v_material_functions);
3977 
3978  /* function exit code */
3979  goto __pyx_L0;
3980  __pyx_L1_error:;
3981  __pyx_r = NULL;
3982  __pyx_L0:;
3983  __Pyx_RefNannyFinishContext();
3984  return __pyx_r;
3985 }
3986 
3987 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_10setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions) {
3988  int __pyx_v_eN;
3989  int __pyx_v_ebN;
3990  int __pyx_v_ebN_local;
3991  int __pyx_v_k;
3992  int __pyx_v_material_left;
3993  int __pyx_v_material_right;
3994  int __pyx_v_I;
3995  int __pyx_v_J;
3996  double __pyx_v_numer;
3997  double __pyx_v_denom;
3998  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_vals;
3999  __Pyx_Buffer __pyx_pybuffer_ebq_vals;
4000  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
4001  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
4002  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
4003  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
4004  PyObject *__pyx_r = NULL;
4005  __Pyx_RefNannyDeclarations
4006  npy_intp __pyx_t_1;
4007  npy_intp __pyx_t_2;
4008  int __pyx_t_3;
4009  npy_intp __pyx_t_4;
4010  npy_intp __pyx_t_5;
4011  int __pyx_t_6;
4012  Py_ssize_t __pyx_t_7;
4013  Py_ssize_t __pyx_t_8;
4014  int __pyx_t_9;
4015  npy_intp __pyx_t_10;
4016  npy_intp __pyx_t_11;
4017  int __pyx_t_12;
4018  int __pyx_t_13;
4019  int __pyx_t_14;
4020  int __pyx_t_15;
4021  int __pyx_t_16;
4022  int __pyx_t_17;
4023  PyObject *__pyx_t_18 = NULL;
4024  PyObject *__pyx_t_19 = NULL;
4025  PyObject *__pyx_t_20 = NULL;
4026  PyObject *__pyx_t_21 = NULL;
4027  PyObject *__pyx_t_22 = NULL;
4028  double __pyx_t_23;
4029  Py_ssize_t __pyx_t_24;
4030  Py_ssize_t __pyx_t_25;
4031  int __pyx_t_26;
4032  int __pyx_lineno = 0;
4033  const char *__pyx_filename = NULL;
4034  int __pyx_clineno = 0;
4035  __Pyx_RefNannySetupContext("setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 0);
4036  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
4037  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
4038  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
4039  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
4040  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
4041  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
4042  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
4043  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
4044  __pyx_pybuffer_ebq_vals.pybuffer.buf = NULL;
4045  __pyx_pybuffer_ebq_vals.refcount = 0;
4046  __pyx_pybuffernd_ebq_vals.data = NULL;
4047  __pyx_pybuffernd_ebq_vals.rcbuffer = &__pyx_pybuffer_ebq_vals;
4048  {
4049  __Pyx_BufFmt_StackElem __pyx_stack[1];
4050  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 91, __pyx_L1_error)
4051  }
4052  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
4053  {
4054  __Pyx_BufFmt_StackElem __pyx_stack[1];
4055  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 91, __pyx_L1_error)
4056  }
4057  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
4058  {
4059  __Pyx_BufFmt_StackElem __pyx_stack[1];
4060  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 91, __pyx_L1_error)
4061  }
4062  __pyx_pybuffernd_ebq_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_ebq_vals.diminfo[2].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_ebq_vals.diminfo[2].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_ebq_vals.diminfo[3].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_ebq_vals.diminfo[3].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[3];
4063 
4064  /* "subsurfaceTransportFunctions.pyx":106
4065  * cdef double numer,denom
4066  *
4067  * for eN in range(ebq_vals.shape[0]): # <<<<<<<<<<<<<<
4068  * for ebN_local in range(ebq_vals.shape[1]):
4069  * ebN = elementBoundariesArray[eN,ebN_local]
4070  */
4071  __pyx_t_1 = (__pyx_v_ebq_vals->dimensions[0]);
4072  __pyx_t_2 = __pyx_t_1;
4073  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
4074  __pyx_v_eN = __pyx_t_3;
4075 
4076  /* "subsurfaceTransportFunctions.pyx":107
4077  *
4078  * for eN in range(ebq_vals.shape[0]):
4079  * for ebN_local in range(ebq_vals.shape[1]): # <<<<<<<<<<<<<<
4080  * ebN = elementBoundariesArray[eN,ebN_local]
4081  * material_left = elementBoundaryTypes[ebN,0]
4082  */
4083  __pyx_t_4 = (__pyx_v_ebq_vals->dimensions[1]);
4084  __pyx_t_5 = __pyx_t_4;
4085  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
4086  __pyx_v_ebN_local = __pyx_t_6;
4087 
4088  /* "subsurfaceTransportFunctions.pyx":108
4089  * for eN in range(ebq_vals.shape[0]):
4090  * for ebN_local in range(ebq_vals.shape[1]):
4091  * ebN = elementBoundariesArray[eN,ebN_local] # <<<<<<<<<<<<<<
4092  * material_left = elementBoundaryTypes[ebN,0]
4093  * material_right= elementBoundaryTypes[ebN,1]
4094  */
4095  __pyx_t_7 = __pyx_v_eN;
4096  __pyx_t_8 = __pyx_v_ebN_local;
4097  __pyx_t_9 = -1;
4098  if (__pyx_t_7 < 0) {
4099  __pyx_t_7 += __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape;
4100  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
4101  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape)) __pyx_t_9 = 0;
4102  if (__pyx_t_8 < 0) {
4103  __pyx_t_8 += __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape;
4104  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
4105  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape)) __pyx_t_9 = 1;
4106  if (unlikely(__pyx_t_9 != -1)) {
4107  __Pyx_RaiseBufferIndexError(__pyx_t_9);
4108  __PYX_ERR(0, 108, __pyx_L1_error)
4109  }
4110  __pyx_v_ebN = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides));
4111 
4112  /* "subsurfaceTransportFunctions.pyx":109
4113  * for ebN_local in range(ebq_vals.shape[1]):
4114  * ebN = elementBoundariesArray[eN,ebN_local]
4115  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
4116  * material_right= elementBoundaryTypes[ebN,1]
4117  * for k in range(ebq_vals.shape[2]):
4118  */
4119  __pyx_t_8 = __pyx_v_ebN;
4120  __pyx_t_7 = 0;
4121  __pyx_t_9 = -1;
4122  if (__pyx_t_8 < 0) {
4123  __pyx_t_8 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
4124  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0;
4125  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_9 = 0;
4126  if (__pyx_t_7 < 0) {
4127  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
4128  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 1;
4129  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_9 = 1;
4130  if (unlikely(__pyx_t_9 != -1)) {
4131  __Pyx_RaiseBufferIndexError(__pyx_t_9);
4132  __PYX_ERR(0, 109, __pyx_L1_error)
4133  }
4134  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
4135 
4136  /* "subsurfaceTransportFunctions.pyx":110
4137  * ebN = elementBoundariesArray[eN,ebN_local]
4138  * material_left = elementBoundaryTypes[ebN,0]
4139  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
4140  * for k in range(ebq_vals.shape[2]):
4141  * for I in range(nd):
4142  */
4143  __pyx_t_7 = __pyx_v_ebN;
4144  __pyx_t_8 = 1;
4145  __pyx_t_9 = -1;
4146  if (__pyx_t_7 < 0) {
4147  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
4148  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
4149  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_9 = 0;
4150  if (__pyx_t_8 < 0) {
4151  __pyx_t_8 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
4152  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
4153  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_9 = 1;
4154  if (unlikely(__pyx_t_9 != -1)) {
4155  __Pyx_RaiseBufferIndexError(__pyx_t_9);
4156  __PYX_ERR(0, 110, __pyx_L1_error)
4157  }
4158  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
4159 
4160  /* "subsurfaceTransportFunctions.pyx":111
4161  * material_left = elementBoundaryTypes[ebN,0]
4162  * material_right= elementBoundaryTypes[ebN,1]
4163  * for k in range(ebq_vals.shape[2]): # <<<<<<<<<<<<<<
4164  * for I in range(nd):
4165  * for J in range(nd):
4166  */
4167  __pyx_t_10 = (__pyx_v_ebq_vals->dimensions[2]);
4168  __pyx_t_11 = __pyx_t_10;
4169  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_11; __pyx_t_9+=1) {
4170  __pyx_v_k = __pyx_t_9;
4171 
4172  /* "subsurfaceTransportFunctions.pyx":112
4173  * material_right= elementBoundaryTypes[ebN,1]
4174  * for k in range(ebq_vals.shape[2]):
4175  * for I in range(nd): # <<<<<<<<<<<<<<
4176  * for J in range(nd):
4177  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
4178  */
4179  __pyx_t_12 = __pyx_v_nd;
4180  __pyx_t_13 = __pyx_t_12;
4181  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
4182  __pyx_v_I = __pyx_t_14;
4183 
4184  /* "subsurfaceTransportFunctions.pyx":113
4185  * for k in range(ebq_vals.shape[2]):
4186  * for I in range(nd):
4187  * for J in range(nd): # <<<<<<<<<<<<<<
4188  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
4189  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20
4190  */
4191  __pyx_t_15 = __pyx_v_nd;
4192  __pyx_t_16 = __pyx_t_15;
4193  for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) {
4194  __pyx_v_J = __pyx_t_17;
4195 
4196  /* "subsurfaceTransportFunctions.pyx":114
4197  * for I in range(nd):
4198  * for J in range(nd):
4199  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J] # <<<<<<<<<<<<<<
4200  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20
4201  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
4202  */
4203  if (unlikely(__pyx_v_material_functions == Py_None)) {
4204  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4205  __PYX_ERR(0, 114, __pyx_L1_error)
4206  }
4207  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 114, __pyx_L1_error)
4208  __Pyx_GOTREF(__pyx_t_18);
4209  __pyx_t_19 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_18); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 114, __pyx_L1_error)
4210  __Pyx_GOTREF(__pyx_t_19);
4211  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
4212  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 114, __pyx_L1_error)
4213  __Pyx_GOTREF(__pyx_t_18);
4214  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 114, __pyx_L1_error)
4215  __Pyx_GOTREF(__pyx_t_20);
4216  __pyx_t_21 = PyTuple_New(2); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 114, __pyx_L1_error)
4217  __Pyx_GOTREF(__pyx_t_21);
4218  __Pyx_GIVEREF(__pyx_t_18);
4219  PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_18);
4220  __Pyx_GIVEREF(__pyx_t_20);
4221  PyTuple_SET_ITEM(__pyx_t_21, 1, __pyx_t_20);
4222  __pyx_t_18 = 0;
4223  __pyx_t_20 = 0;
4224  __pyx_t_20 = __Pyx_PyObject_GetItem(__pyx_t_19, __pyx_t_21); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 114, __pyx_L1_error)
4225  __Pyx_GOTREF(__pyx_t_20);
4226  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
4227  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
4228  __pyx_t_21 = PyNumber_Multiply(__pyx_float_2_0, __pyx_t_20); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 114, __pyx_L1_error)
4229  __Pyx_GOTREF(__pyx_t_21);
4230  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
4231  if (unlikely(__pyx_v_material_functions == Py_None)) {
4232  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4233  __PYX_ERR(0, 114, __pyx_L1_error)
4234  }
4235  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 114, __pyx_L1_error)
4236  __Pyx_GOTREF(__pyx_t_20);
4237  __pyx_t_19 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_20); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 114, __pyx_L1_error)
4238  __Pyx_GOTREF(__pyx_t_19);
4239  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
4240  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 114, __pyx_L1_error)
4241  __Pyx_GOTREF(__pyx_t_20);
4242  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 114, __pyx_L1_error)
4243  __Pyx_GOTREF(__pyx_t_18);
4244  __pyx_t_22 = PyTuple_New(2); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 114, __pyx_L1_error)
4245  __Pyx_GOTREF(__pyx_t_22);
4246  __Pyx_GIVEREF(__pyx_t_20);
4247  PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_20);
4248  __Pyx_GIVEREF(__pyx_t_18);
4249  PyTuple_SET_ITEM(__pyx_t_22, 1, __pyx_t_18);
4250  __pyx_t_20 = 0;
4251  __pyx_t_18 = 0;
4252  __pyx_t_18 = __Pyx_PyObject_GetItem(__pyx_t_19, __pyx_t_22); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 114, __pyx_L1_error)
4253  __Pyx_GOTREF(__pyx_t_18);
4254  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
4255  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
4256  __pyx_t_22 = PyNumber_Multiply(__pyx_t_21, __pyx_t_18); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 114, __pyx_L1_error)
4257  __Pyx_GOTREF(__pyx_t_22);
4258  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
4259  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
4260  __pyx_t_23 = __pyx_PyFloat_AsDouble(__pyx_t_22); if (unlikely((__pyx_t_23 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 114, __pyx_L1_error)
4261  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
4262  __pyx_v_numer = __pyx_t_23;
4263 
4264  /* "subsurfaceTransportFunctions.pyx":115
4265  * for J in range(nd):
4266  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
4267  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20 # <<<<<<<<<<<<<<
4268  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
4269  *
4270  */
4271  if (unlikely(__pyx_v_material_functions == Py_None)) {
4272  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4273  __PYX_ERR(0, 115, __pyx_L1_error)
4274  }
4275  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 115, __pyx_L1_error)
4276  __Pyx_GOTREF(__pyx_t_22);
4277  __pyx_t_18 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_22); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 115, __pyx_L1_error)
4278  __Pyx_GOTREF(__pyx_t_18);
4279  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
4280  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 115, __pyx_L1_error)
4281  __Pyx_GOTREF(__pyx_t_22);
4282  __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 115, __pyx_L1_error)
4283  __Pyx_GOTREF(__pyx_t_21);
4284  __pyx_t_19 = PyTuple_New(2); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 115, __pyx_L1_error)
4285  __Pyx_GOTREF(__pyx_t_19);
4286  __Pyx_GIVEREF(__pyx_t_22);
4287  PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_22);
4288  __Pyx_GIVEREF(__pyx_t_21);
4289  PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_t_21);
4290  __pyx_t_22 = 0;
4291  __pyx_t_21 = 0;
4292  __pyx_t_21 = __Pyx_PyObject_GetItem(__pyx_t_18, __pyx_t_19); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 115, __pyx_L1_error)
4293  __Pyx_GOTREF(__pyx_t_21);
4294  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
4295  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
4296  if (unlikely(__pyx_v_material_functions == Py_None)) {
4297  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4298  __PYX_ERR(0, 115, __pyx_L1_error)
4299  }
4300  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 115, __pyx_L1_error)
4301  __Pyx_GOTREF(__pyx_t_19);
4302  __pyx_t_18 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_19); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 115, __pyx_L1_error)
4303  __Pyx_GOTREF(__pyx_t_18);
4304  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
4305  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 115, __pyx_L1_error)
4306  __Pyx_GOTREF(__pyx_t_19);
4307  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 115, __pyx_L1_error)
4308  __Pyx_GOTREF(__pyx_t_22);
4309  __pyx_t_20 = PyTuple_New(2); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 115, __pyx_L1_error)
4310  __Pyx_GOTREF(__pyx_t_20);
4311  __Pyx_GIVEREF(__pyx_t_19);
4312  PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_19);
4313  __Pyx_GIVEREF(__pyx_t_22);
4314  PyTuple_SET_ITEM(__pyx_t_20, 1, __pyx_t_22);
4315  __pyx_t_19 = 0;
4316  __pyx_t_22 = 0;
4317  __pyx_t_22 = __Pyx_PyObject_GetItem(__pyx_t_18, __pyx_t_20); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 115, __pyx_L1_error)
4318  __Pyx_GOTREF(__pyx_t_22);
4319  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
4320  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
4321  __pyx_t_20 = PyNumber_Add(__pyx_t_21, __pyx_t_22); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 115, __pyx_L1_error)
4322  __Pyx_GOTREF(__pyx_t_20);
4323  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
4324  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
4325  __pyx_t_22 = __Pyx_PyFloat_AddObjC(__pyx_t_20, __pyx_float_1_0eneg_20, 1.0e-20, 0, 0); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 115, __pyx_L1_error)
4326  __Pyx_GOTREF(__pyx_t_22);
4327  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
4328  __pyx_t_23 = __pyx_PyFloat_AsDouble(__pyx_t_22); if (unlikely((__pyx_t_23 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 115, __pyx_L1_error)
4329  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
4330  __pyx_v_denom = __pyx_t_23;
4331 
4332  /* "subsurfaceTransportFunctions.pyx":116
4333  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
4334  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20
4335  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom # <<<<<<<<<<<<<<
4336  *
4337  * def setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
4338  */
4339  if (unlikely(__pyx_v_denom == 0)) {
4340  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
4341  __PYX_ERR(0, 116, __pyx_L1_error)
4342  }
4343  __pyx_t_8 = __pyx_v_eN;
4344  __pyx_t_7 = __pyx_v_ebN_local;
4345  __pyx_t_24 = __pyx_v_k;
4346  __pyx_t_25 = ((__pyx_v_I * __pyx_v_nd) + __pyx_v_J);
4347  __pyx_t_26 = -1;
4348  if (__pyx_t_8 < 0) {
4349  __pyx_t_8 += __pyx_pybuffernd_ebq_vals.diminfo[0].shape;
4350  if (unlikely(__pyx_t_8 < 0)) __pyx_t_26 = 0;
4351  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_ebq_vals.diminfo[0].shape)) __pyx_t_26 = 0;
4352  if (__pyx_t_7 < 0) {
4353  __pyx_t_7 += __pyx_pybuffernd_ebq_vals.diminfo[1].shape;
4354  if (unlikely(__pyx_t_7 < 0)) __pyx_t_26 = 1;
4355  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_ebq_vals.diminfo[1].shape)) __pyx_t_26 = 1;
4356  if (__pyx_t_24 < 0) {
4357  __pyx_t_24 += __pyx_pybuffernd_ebq_vals.diminfo[2].shape;
4358  if (unlikely(__pyx_t_24 < 0)) __pyx_t_26 = 2;
4359  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_ebq_vals.diminfo[2].shape)) __pyx_t_26 = 2;
4360  if (__pyx_t_25 < 0) {
4361  __pyx_t_25 += __pyx_pybuffernd_ebq_vals.diminfo[3].shape;
4362  if (unlikely(__pyx_t_25 < 0)) __pyx_t_26 = 3;
4363  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_ebq_vals.diminfo[3].shape)) __pyx_t_26 = 3;
4364  if (unlikely(__pyx_t_26 != -1)) {
4365  __Pyx_RaiseBufferIndexError(__pyx_t_26);
4366  __PYX_ERR(0, 116, __pyx_L1_error)
4367  }
4368  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_ebq_vals.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_ebq_vals.diminfo[1].strides, __pyx_t_24, __pyx_pybuffernd_ebq_vals.diminfo[2].strides, __pyx_t_25, __pyx_pybuffernd_ebq_vals.diminfo[3].strides) = (__pyx_v_numer / __pyx_v_denom);
4369  }
4370  }
4371  }
4372  }
4373  }
4374 
4375  /* "subsurfaceTransportFunctions.pyx":91
4376  * material_functions[material_right])
4377  *
4378  * def setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
4379  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
4380  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
4381  */
4382 
4383  /* function exit code */
4384  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4385  goto __pyx_L0;
4386  __pyx_L1_error:;
4387  __Pyx_XDECREF(__pyx_t_18);
4388  __Pyx_XDECREF(__pyx_t_19);
4389  __Pyx_XDECREF(__pyx_t_20);
4390  __Pyx_XDECREF(__pyx_t_21);
4391  __Pyx_XDECREF(__pyx_t_22);
4392  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
4393  __Pyx_PyThreadState_declare
4394  __Pyx_PyThreadState_assign
4395  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
4396  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
4397  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
4398  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
4399  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
4400  __Pyx_AddTraceback("subsurfaceTransportFunctions.setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
4401  __pyx_r = NULL;
4402  goto __pyx_L2;
4403  __pyx_L0:;
4404  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
4405  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
4406  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
4407  __pyx_L2:;
4408  __Pyx_XGIVEREF(__pyx_r);
4409  __Pyx_RefNannyFinishContext();
4410  return __pyx_r;
4411 }
4412 
4413 /* "subsurfaceTransportFunctions.pyx":118
4414  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
4415  *
4416  * def setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
4417  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
4418  * numpy.ndarray[DTYPE_t,ndim=2] ebq_global_vals,
4419  */
4420 
4421 /* Python wrapper */
4422 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_13setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4423 static char __pyx_doc_28subsurfaceTransportFunctions_12setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage[] = "\n loop over quadrature array and evaluate function f = 0.5(f^L_j+f^R_k) assuming element on left \n is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
4424 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_13setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage = {"setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_13setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_12setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage};
4425 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_13setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4426  CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray = 0;
4427  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
4428  PyArrayObject *__pyx_v_ebq_global_vals = 0;
4429  PyObject *__pyx_v_material_functions = 0;
4430  int __pyx_lineno = 0;
4431  const char *__pyx_filename = NULL;
4432  int __pyx_clineno = 0;
4433  PyObject *__pyx_r = 0;
4434  __Pyx_RefNannyDeclarations
4435  __Pyx_RefNannySetupContext("setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage (wrapper)", 0);
4436  {
4437  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_ebq_global_vals,&__pyx_n_s_material_functions,0};
4438  PyObject* values[4] = {0,0,0,0};
4439  if (unlikely(__pyx_kwds)) {
4440  Py_ssize_t kw_args;
4441  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4442  switch (pos_args) {
4443  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4444  CYTHON_FALLTHROUGH;
4445  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4446  CYTHON_FALLTHROUGH;
4447  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4448  CYTHON_FALLTHROUGH;
4449  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4450  CYTHON_FALLTHROUGH;
4451  case 0: break;
4452  default: goto __pyx_L5_argtuple_error;
4453  }
4454  kw_args = PyDict_Size(__pyx_kwds);
4455  switch (pos_args) {
4456  case 0:
4457  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
4458  else goto __pyx_L5_argtuple_error;
4459  CYTHON_FALLTHROUGH;
4460  case 1:
4461  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
4462  else {
4463  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 4, 4, 1); __PYX_ERR(0, 118, __pyx_L3_error)
4464  }
4465  CYTHON_FALLTHROUGH;
4466  case 2:
4467  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ebq_global_vals)) != 0)) kw_args--;
4468  else {
4469  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 4, 4, 2); __PYX_ERR(0, 118, __pyx_L3_error)
4470  }
4471  CYTHON_FALLTHROUGH;
4472  case 3:
4473  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
4474  else {
4475  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 4, 4, 3); __PYX_ERR(0, 118, __pyx_L3_error)
4476  }
4477  }
4478  if (unlikely(kw_args > 0)) {
4479  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage") < 0)) __PYX_ERR(0, 118, __pyx_L3_error)
4480  }
4481  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
4482  goto __pyx_L5_argtuple_error;
4483  } else {
4484  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4485  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4486  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4487  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4488  }
4489  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[0]);
4490  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[1]);
4491  __pyx_v_ebq_global_vals = ((PyArrayObject *)values[2]);
4492  __pyx_v_material_functions = ((PyObject*)values[3]);
4493  }
4494  goto __pyx_L4_argument_unpacking_done;
4495  __pyx_L5_argtuple_error:;
4496  __Pyx_RaiseArgtupleInvalid("setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 118, __pyx_L3_error)
4497  __pyx_L3_error:;
4498  __Pyx_AddTraceback("subsurfaceTransportFunctions.setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
4499  __Pyx_RefNannyFinishContext();
4500  return NULL;
4501  __pyx_L4_argument_unpacking_done:;
4502  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) __PYX_ERR(0, 118, __pyx_L1_error)
4503  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) __PYX_ERR(0, 119, __pyx_L1_error)
4504  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_global_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_global_vals", 0))) __PYX_ERR(0, 120, __pyx_L1_error)
4505  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 121, __pyx_L1_error)
4506  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_12setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(__pyx_self, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_ebq_global_vals, __pyx_v_material_functions);
4507 
4508  /* function exit code */
4509  goto __pyx_L0;
4510  __pyx_L1_error:;
4511  __pyx_r = NULL;
4512  __pyx_L0:;
4513  __Pyx_RefNannyFinishContext();
4514  return __pyx_r;
4515 }
4516 
4517 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_12setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions) {
4518  int __pyx_v_ebN;
4519  int __pyx_v_material_left;
4520  int __pyx_v_material_right;
4521  npy_intp __pyx_v_k;
4522  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_global_vals;
4523  __Pyx_Buffer __pyx_pybuffer_ebq_global_vals;
4524  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
4525  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
4526  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
4527  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
4528  PyObject *__pyx_r = NULL;
4529  __Pyx_RefNannyDeclarations
4530  npy_intp __pyx_t_1;
4531  npy_intp __pyx_t_2;
4532  int __pyx_t_3;
4533  Py_ssize_t __pyx_t_4;
4534  Py_ssize_t __pyx_t_5;
4535  int __pyx_t_6;
4536  npy_intp __pyx_t_7;
4537  npy_intp __pyx_t_8;
4538  npy_intp __pyx_t_9;
4539  PyObject *__pyx_t_10 = NULL;
4540  PyObject *__pyx_t_11 = NULL;
4541  PyObject *__pyx_t_12 = NULL;
4542  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_13;
4543  int __pyx_lineno = 0;
4544  const char *__pyx_filename = NULL;
4545  int __pyx_clineno = 0;
4546  __Pyx_RefNannySetupContext("setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 0);
4547  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
4548  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
4549  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
4550  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
4551  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
4552  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
4553  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
4554  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
4555  __pyx_pybuffer_ebq_global_vals.pybuffer.buf = NULL;
4556  __pyx_pybuffer_ebq_global_vals.refcount = 0;
4557  __pyx_pybuffernd_ebq_global_vals.data = NULL;
4558  __pyx_pybuffernd_ebq_global_vals.rcbuffer = &__pyx_pybuffer_ebq_global_vals;
4559  {
4560  __Pyx_BufFmt_StackElem __pyx_stack[1];
4561  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 118, __pyx_L1_error)
4562  }
4563  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
4564  {
4565  __Pyx_BufFmt_StackElem __pyx_stack[1];
4566  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 118, __pyx_L1_error)
4567  }
4568  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
4569  {
4570  __Pyx_BufFmt_StackElem __pyx_stack[1];
4571  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_global_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 118, __pyx_L1_error)
4572  }
4573  __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[1];
4574 
4575  /* "subsurfaceTransportFunctions.pyx":131
4576  * cdef int ebN,material_left,material_right
4577  *
4578  * for ebN in range(ebq_global_vals.shape[0]): # <<<<<<<<<<<<<<
4579  * material_left = elementBoundaryTypes[ebN,0]
4580  * material_right= elementBoundaryTypes[ebN,1]
4581  */
4582  __pyx_t_1 = (__pyx_v_ebq_global_vals->dimensions[0]);
4583  __pyx_t_2 = __pyx_t_1;
4584  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
4585  __pyx_v_ebN = __pyx_t_3;
4586 
4587  /* "subsurfaceTransportFunctions.pyx":132
4588  *
4589  * for ebN in range(ebq_global_vals.shape[0]):
4590  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
4591  * material_right= elementBoundaryTypes[ebN,1]
4592  * for k in range(ebq_global_vals.shape[1]):
4593  */
4594  __pyx_t_4 = __pyx_v_ebN;
4595  __pyx_t_5 = 0;
4596  __pyx_t_6 = -1;
4597  if (__pyx_t_4 < 0) {
4598  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
4599  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 0;
4600  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_6 = 0;
4601  if (__pyx_t_5 < 0) {
4602  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
4603  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 1;
4604  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_6 = 1;
4605  if (unlikely(__pyx_t_6 != -1)) {
4606  __Pyx_RaiseBufferIndexError(__pyx_t_6);
4607  __PYX_ERR(0, 132, __pyx_L1_error)
4608  }
4609  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_5, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
4610 
4611  /* "subsurfaceTransportFunctions.pyx":133
4612  * for ebN in range(ebq_global_vals.shape[0]):
4613  * material_left = elementBoundaryTypes[ebN,0]
4614  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
4615  * for k in range(ebq_global_vals.shape[1]):
4616  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left]+
4617  */
4618  __pyx_t_5 = __pyx_v_ebN;
4619  __pyx_t_4 = 1;
4620  __pyx_t_6 = -1;
4621  if (__pyx_t_5 < 0) {
4622  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
4623  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 0;
4624  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_6 = 0;
4625  if (__pyx_t_4 < 0) {
4626  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
4627  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 1;
4628  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_6 = 1;
4629  if (unlikely(__pyx_t_6 != -1)) {
4630  __Pyx_RaiseBufferIndexError(__pyx_t_6);
4631  __PYX_ERR(0, 133, __pyx_L1_error)
4632  }
4633  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_4, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
4634 
4635  /* "subsurfaceTransportFunctions.pyx":134
4636  * material_left = elementBoundaryTypes[ebN,0]
4637  * material_right= elementBoundaryTypes[ebN,1]
4638  * for k in range(ebq_global_vals.shape[1]): # <<<<<<<<<<<<<<
4639  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left]+
4640  * material_functions[material_right])
4641  */
4642  __pyx_t_7 = (__pyx_v_ebq_global_vals->dimensions[1]);
4643  __pyx_t_8 = __pyx_t_7;
4644  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
4645  __pyx_v_k = __pyx_t_9;
4646 
4647  /* "subsurfaceTransportFunctions.pyx":135
4648  * material_right= elementBoundaryTypes[ebN,1]
4649  * for k in range(ebq_global_vals.shape[1]):
4650  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left]+ # <<<<<<<<<<<<<<
4651  * material_functions[material_right])
4652  *
4653  */
4654  if (unlikely(__pyx_v_material_functions == Py_None)) {
4655  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4656  __PYX_ERR(0, 135, __pyx_L1_error)
4657  }
4658  __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 135, __pyx_L1_error)
4659  __Pyx_GOTREF(__pyx_t_10);
4660  __pyx_t_11 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 135, __pyx_L1_error)
4661  __Pyx_GOTREF(__pyx_t_11);
4662  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4663 
4664  /* "subsurfaceTransportFunctions.pyx":136
4665  * for k in range(ebq_global_vals.shape[1]):
4666  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left]+
4667  * material_functions[material_right]) # <<<<<<<<<<<<<<
4668  *
4669  *
4670  */
4671  if (unlikely(__pyx_v_material_functions == Py_None)) {
4672  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
4673  __PYX_ERR(0, 136, __pyx_L1_error)
4674  }
4675  __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 136, __pyx_L1_error)
4676  __Pyx_GOTREF(__pyx_t_10);
4677  __pyx_t_12 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_10); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 136, __pyx_L1_error)
4678  __Pyx_GOTREF(__pyx_t_12);
4679  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4680 
4681  /* "subsurfaceTransportFunctions.pyx":135
4682  * material_right= elementBoundaryTypes[ebN,1]
4683  * for k in range(ebq_global_vals.shape[1]):
4684  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left]+ # <<<<<<<<<<<<<<
4685  * material_functions[material_right])
4686  *
4687  */
4688  __pyx_t_10 = PyNumber_Add(__pyx_t_11, __pyx_t_12); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 135, __pyx_L1_error)
4689  __Pyx_GOTREF(__pyx_t_10);
4690  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
4691  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
4692  __pyx_t_12 = PyNumber_Multiply(__pyx_float_0_5, __pyx_t_10); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 135, __pyx_L1_error)
4693  __Pyx_GOTREF(__pyx_t_12);
4694  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4695  __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_13 == ((npy_double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 135, __pyx_L1_error)
4696  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
4697  __pyx_t_4 = __pyx_v_ebN;
4698  __pyx_t_5 = __pyx_v_k;
4699  __pyx_t_6 = -1;
4700  if (__pyx_t_4 < 0) {
4701  __pyx_t_4 += __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape;
4702  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 0;
4703  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape)) __pyx_t_6 = 0;
4704  if (__pyx_t_5 < 0) {
4705  __pyx_t_5 += __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape;
4706  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 1;
4707  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape)) __pyx_t_6 = 1;
4708  if (unlikely(__pyx_t_6 != -1)) {
4709  __Pyx_RaiseBufferIndexError(__pyx_t_6);
4710  __PYX_ERR(0, 135, __pyx_L1_error)
4711  }
4712  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides, __pyx_t_5, __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides) = __pyx_t_13;
4713  }
4714  }
4715 
4716  /* "subsurfaceTransportFunctions.pyx":118
4717  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
4718  *
4719  * def setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
4720  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
4721  * numpy.ndarray[DTYPE_t,ndim=2] ebq_global_vals,
4722  */
4723 
4724  /* function exit code */
4725  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4726  goto __pyx_L0;
4727  __pyx_L1_error:;
4728  __Pyx_XDECREF(__pyx_t_10);
4729  __Pyx_XDECREF(__pyx_t_11);
4730  __Pyx_XDECREF(__pyx_t_12);
4731  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
4732  __Pyx_PyThreadState_declare
4733  __Pyx_PyThreadState_assign
4734  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
4735  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
4736  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
4737  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
4738  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
4739  __Pyx_AddTraceback("subsurfaceTransportFunctions.setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
4740  __pyx_r = NULL;
4741  goto __pyx_L2;
4742  __pyx_L0:;
4743  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
4744  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
4745  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
4746  __pyx_L2:;
4747  __Pyx_XGIVEREF(__pyx_r);
4748  __Pyx_RefNannyFinishContext();
4749  return __pyx_r;
4750 }
4751 
4752 /* "subsurfaceTransportFunctions.pyx":139
4753  *
4754  *
4755  * def setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
4756  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
4757  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
4758  */
4759 
4760 /* Python wrapper */
4761 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_15setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4762 static char __pyx_doc_28subsurfaceTransportFunctions_14setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage[] = "\n loop over quadrature array and evaluate function \ten f_{mn} = f^L_{j,mn}f^R_{k,mn}/(f^L_{j,mn}+f^R_{k,mn})\n assuming element on left is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
4763 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_15setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage = {"setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_15setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_14setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage};
4764 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_15setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4765  int __pyx_v_nd;
4766  CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray = 0;
4767  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
4768  PyArrayObject *__pyx_v_ebq_global_vals = 0;
4769  PyObject *__pyx_v_material_functions = 0;
4770  int __pyx_lineno = 0;
4771  const char *__pyx_filename = NULL;
4772  int __pyx_clineno = 0;
4773  PyObject *__pyx_r = 0;
4774  __Pyx_RefNannyDeclarations
4775  __Pyx_RefNannySetupContext("setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage (wrapper)", 0);
4776  {
4777  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nd,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_ebq_global_vals,&__pyx_n_s_material_functions,0};
4778  PyObject* values[5] = {0,0,0,0,0};
4779  if (unlikely(__pyx_kwds)) {
4780  Py_ssize_t kw_args;
4781  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4782  switch (pos_args) {
4783  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4784  CYTHON_FALLTHROUGH;
4785  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4786  CYTHON_FALLTHROUGH;
4787  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4788  CYTHON_FALLTHROUGH;
4789  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4790  CYTHON_FALLTHROUGH;
4791  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4792  CYTHON_FALLTHROUGH;
4793  case 0: break;
4794  default: goto __pyx_L5_argtuple_error;
4795  }
4796  kw_args = PyDict_Size(__pyx_kwds);
4797  switch (pos_args) {
4798  case 0:
4799  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nd)) != 0)) kw_args--;
4800  else goto __pyx_L5_argtuple_error;
4801  CYTHON_FALLTHROUGH;
4802  case 1:
4803  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
4804  else {
4805  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 5, 5, 1); __PYX_ERR(0, 139, __pyx_L3_error)
4806  }
4807  CYTHON_FALLTHROUGH;
4808  case 2:
4809  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
4810  else {
4811  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 5, 5, 2); __PYX_ERR(0, 139, __pyx_L3_error)
4812  }
4813  CYTHON_FALLTHROUGH;
4814  case 3:
4815  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ebq_global_vals)) != 0)) kw_args--;
4816  else {
4817  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 5, 5, 3); __PYX_ERR(0, 139, __pyx_L3_error)
4818  }
4819  CYTHON_FALLTHROUGH;
4820  case 4:
4821  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
4822  else {
4823  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 5, 5, 4); __PYX_ERR(0, 139, __pyx_L3_error)
4824  }
4825  }
4826  if (unlikely(kw_args > 0)) {
4827  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage") < 0)) __PYX_ERR(0, 139, __pyx_L3_error)
4828  }
4829  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
4830  goto __pyx_L5_argtuple_error;
4831  } else {
4832  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4833  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4834  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4835  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4836  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4837  }
4838  __pyx_v_nd = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_nd == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 139, __pyx_L3_error)
4839  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[1]);
4840  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[2]);
4841  __pyx_v_ebq_global_vals = ((PyArrayObject *)values[3]);
4842  __pyx_v_material_functions = ((PyObject*)values[4]);
4843  }
4844  goto __pyx_L4_argument_unpacking_done;
4845  __pyx_L5_argtuple_error:;
4846  __Pyx_RaiseArgtupleInvalid("setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 139, __pyx_L3_error)
4847  __pyx_L3_error:;
4848  __Pyx_AddTraceback("subsurfaceTransportFunctions.setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
4849  __Pyx_RefNannyFinishContext();
4850  return NULL;
4851  __pyx_L4_argument_unpacking_done:;
4852  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) __PYX_ERR(0, 140, __pyx_L1_error)
4853  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) __PYX_ERR(0, 141, __pyx_L1_error)
4854  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_global_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_global_vals", 0))) __PYX_ERR(0, 142, __pyx_L1_error)
4855  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 143, __pyx_L1_error)
4856  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_14setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(__pyx_self, __pyx_v_nd, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_ebq_global_vals, __pyx_v_material_functions);
4857 
4858  /* function exit code */
4859  goto __pyx_L0;
4860  __pyx_L1_error:;
4861  __pyx_r = NULL;
4862  __pyx_L0:;
4863  __Pyx_RefNannyFinishContext();
4864  return __pyx_r;
4865 }
4866 
4867 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_14setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions) {
4868  int __pyx_v_ebN;
4869  int __pyx_v_k;
4870  int __pyx_v_material_left;
4871  int __pyx_v_material_right;
4872  int __pyx_v_I;
4873  int __pyx_v_J;
4874  double __pyx_v_numer;
4875  double __pyx_v_denom;
4876  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_global_vals;
4877  __Pyx_Buffer __pyx_pybuffer_ebq_global_vals;
4878  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
4879  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
4880  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
4881  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
4882  PyObject *__pyx_r = NULL;
4883  __Pyx_RefNannyDeclarations
4884  npy_intp __pyx_t_1;
4885  npy_intp __pyx_t_2;
4886  int __pyx_t_3;
4887  Py_ssize_t __pyx_t_4;
4888  Py_ssize_t __pyx_t_5;
4889  int __pyx_t_6;
4890  npy_intp __pyx_t_7;
4891  npy_intp __pyx_t_8;
4892  int __pyx_t_9;
4893  int __pyx_t_10;
4894  int __pyx_t_11;
4895  int __pyx_t_12;
4896  int __pyx_t_13;
4897  int __pyx_t_14;
4898  PyObject *__pyx_t_15 = NULL;
4899  PyObject *__pyx_t_16 = NULL;
4900  PyObject *__pyx_t_17 = NULL;
4901  PyObject *__pyx_t_18 = NULL;
4902  PyObject *__pyx_t_19 = NULL;
4903  double __pyx_t_20;
4904  Py_ssize_t __pyx_t_21;
4905  int __pyx_t_22;
4906  int __pyx_lineno = 0;
4907  const char *__pyx_filename = NULL;
4908  int __pyx_clineno = 0;
4909  __Pyx_RefNannySetupContext("setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 0);
4910  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
4911  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
4912  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
4913  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
4914  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
4915  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
4916  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
4917  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
4918  __pyx_pybuffer_ebq_global_vals.pybuffer.buf = NULL;
4919  __pyx_pybuffer_ebq_global_vals.refcount = 0;
4920  __pyx_pybuffernd_ebq_global_vals.data = NULL;
4921  __pyx_pybuffernd_ebq_global_vals.rcbuffer = &__pyx_pybuffer_ebq_global_vals;
4922  {
4923  __Pyx_BufFmt_StackElem __pyx_stack[1];
4924  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 139, __pyx_L1_error)
4925  }
4926  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
4927  {
4928  __Pyx_BufFmt_StackElem __pyx_stack[1];
4929  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 139, __pyx_L1_error)
4930  }
4931  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
4932  {
4933  __Pyx_BufFmt_StackElem __pyx_stack[1];
4934  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_global_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 139, __pyx_L1_error)
4935  }
4936  __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_ebq_global_vals.diminfo[2].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_ebq_global_vals.diminfo[2].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[2];
4937 
4938  /* "subsurfaceTransportFunctions.pyx":154
4939  * cdef double numer,denom
4940  *
4941  * for ebN in range(ebq_global_vals.shape[0]): # <<<<<<<<<<<<<<
4942  * material_left = elementBoundaryTypes[ebN,0]
4943  * material_right= elementBoundaryTypes[ebN,1]
4944  */
4945  __pyx_t_1 = (__pyx_v_ebq_global_vals->dimensions[0]);
4946  __pyx_t_2 = __pyx_t_1;
4947  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
4948  __pyx_v_ebN = __pyx_t_3;
4949 
4950  /* "subsurfaceTransportFunctions.pyx":155
4951  *
4952  * for ebN in range(ebq_global_vals.shape[0]):
4953  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
4954  * material_right= elementBoundaryTypes[ebN,1]
4955  * for k in range(ebq_global_vals.shape[1]):
4956  */
4957  __pyx_t_4 = __pyx_v_ebN;
4958  __pyx_t_5 = 0;
4959  __pyx_t_6 = -1;
4960  if (__pyx_t_4 < 0) {
4961  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
4962  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 0;
4963  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_6 = 0;
4964  if (__pyx_t_5 < 0) {
4965  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
4966  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 1;
4967  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_6 = 1;
4968  if (unlikely(__pyx_t_6 != -1)) {
4969  __Pyx_RaiseBufferIndexError(__pyx_t_6);
4970  __PYX_ERR(0, 155, __pyx_L1_error)
4971  }
4972  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_5, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
4973 
4974  /* "subsurfaceTransportFunctions.pyx":156
4975  * for ebN in range(ebq_global_vals.shape[0]):
4976  * material_left = elementBoundaryTypes[ebN,0]
4977  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
4978  * for k in range(ebq_global_vals.shape[1]):
4979  * for I in range(nd):
4980  */
4981  __pyx_t_5 = __pyx_v_ebN;
4982  __pyx_t_4 = 1;
4983  __pyx_t_6 = -1;
4984  if (__pyx_t_5 < 0) {
4985  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
4986  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 0;
4987  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_6 = 0;
4988  if (__pyx_t_4 < 0) {
4989  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
4990  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 1;
4991  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_6 = 1;
4992  if (unlikely(__pyx_t_6 != -1)) {
4993  __Pyx_RaiseBufferIndexError(__pyx_t_6);
4994  __PYX_ERR(0, 156, __pyx_L1_error)
4995  }
4996  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_4, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
4997 
4998  /* "subsurfaceTransportFunctions.pyx":157
4999  * material_left = elementBoundaryTypes[ebN,0]
5000  * material_right= elementBoundaryTypes[ebN,1]
5001  * for k in range(ebq_global_vals.shape[1]): # <<<<<<<<<<<<<<
5002  * for I in range(nd):
5003  * for J in range(nd):
5004  */
5005  __pyx_t_7 = (__pyx_v_ebq_global_vals->dimensions[1]);
5006  __pyx_t_8 = __pyx_t_7;
5007  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_8; __pyx_t_6+=1) {
5008  __pyx_v_k = __pyx_t_6;
5009 
5010  /* "subsurfaceTransportFunctions.pyx":158
5011  * material_right= elementBoundaryTypes[ebN,1]
5012  * for k in range(ebq_global_vals.shape[1]):
5013  * for I in range(nd): # <<<<<<<<<<<<<<
5014  * for J in range(nd):
5015  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
5016  */
5017  __pyx_t_9 = __pyx_v_nd;
5018  __pyx_t_10 = __pyx_t_9;
5019  for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
5020  __pyx_v_I = __pyx_t_11;
5021 
5022  /* "subsurfaceTransportFunctions.pyx":159
5023  * for k in range(ebq_global_vals.shape[1]):
5024  * for I in range(nd):
5025  * for J in range(nd): # <<<<<<<<<<<<<<
5026  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
5027  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20
5028  */
5029  __pyx_t_12 = __pyx_v_nd;
5030  __pyx_t_13 = __pyx_t_12;
5031  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
5032  __pyx_v_J = __pyx_t_14;
5033 
5034  /* "subsurfaceTransportFunctions.pyx":160
5035  * for I in range(nd):
5036  * for J in range(nd):
5037  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J] # <<<<<<<<<<<<<<
5038  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20
5039  * ebq_global_vals[ebN,k,I*nd+J] = numer/denom
5040  */
5041  if (unlikely(__pyx_v_material_functions == Py_None)) {
5042  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5043  __PYX_ERR(0, 160, __pyx_L1_error)
5044  }
5045  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 160, __pyx_L1_error)
5046  __Pyx_GOTREF(__pyx_t_15);
5047  __pyx_t_16 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_15); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 160, __pyx_L1_error)
5048  __Pyx_GOTREF(__pyx_t_16);
5049  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
5050  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 160, __pyx_L1_error)
5051  __Pyx_GOTREF(__pyx_t_15);
5052  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 160, __pyx_L1_error)
5053  __Pyx_GOTREF(__pyx_t_17);
5054  __pyx_t_18 = PyTuple_New(2); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 160, __pyx_L1_error)
5055  __Pyx_GOTREF(__pyx_t_18);
5056  __Pyx_GIVEREF(__pyx_t_15);
5057  PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_15);
5058  __Pyx_GIVEREF(__pyx_t_17);
5059  PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_17);
5060  __pyx_t_15 = 0;
5061  __pyx_t_17 = 0;
5062  __pyx_t_17 = __Pyx_PyObject_GetItem(__pyx_t_16, __pyx_t_18); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 160, __pyx_L1_error)
5063  __Pyx_GOTREF(__pyx_t_17);
5064  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
5065  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
5066  __pyx_t_18 = PyNumber_Multiply(__pyx_float_2_0, __pyx_t_17); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 160, __pyx_L1_error)
5067  __Pyx_GOTREF(__pyx_t_18);
5068  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
5069  if (unlikely(__pyx_v_material_functions == Py_None)) {
5070  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5071  __PYX_ERR(0, 160, __pyx_L1_error)
5072  }
5073  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 160, __pyx_L1_error)
5074  __Pyx_GOTREF(__pyx_t_17);
5075  __pyx_t_16 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_17); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 160, __pyx_L1_error)
5076  __Pyx_GOTREF(__pyx_t_16);
5077  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
5078  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 160, __pyx_L1_error)
5079  __Pyx_GOTREF(__pyx_t_17);
5080  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 160, __pyx_L1_error)
5081  __Pyx_GOTREF(__pyx_t_15);
5082  __pyx_t_19 = PyTuple_New(2); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 160, __pyx_L1_error)
5083  __Pyx_GOTREF(__pyx_t_19);
5084  __Pyx_GIVEREF(__pyx_t_17);
5085  PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_17);
5086  __Pyx_GIVEREF(__pyx_t_15);
5087  PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_t_15);
5088  __pyx_t_17 = 0;
5089  __pyx_t_15 = 0;
5090  __pyx_t_15 = __Pyx_PyObject_GetItem(__pyx_t_16, __pyx_t_19); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 160, __pyx_L1_error)
5091  __Pyx_GOTREF(__pyx_t_15);
5092  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
5093  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
5094  __pyx_t_19 = PyNumber_Multiply(__pyx_t_18, __pyx_t_15); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 160, __pyx_L1_error)
5095  __Pyx_GOTREF(__pyx_t_19);
5096  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
5097  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
5098  __pyx_t_20 = __pyx_PyFloat_AsDouble(__pyx_t_19); if (unlikely((__pyx_t_20 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 160, __pyx_L1_error)
5099  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
5100  __pyx_v_numer = __pyx_t_20;
5101 
5102  /* "subsurfaceTransportFunctions.pyx":161
5103  * for J in range(nd):
5104  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
5105  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20 # <<<<<<<<<<<<<<
5106  * ebq_global_vals[ebN,k,I*nd+J] = numer/denom
5107  *
5108  */
5109  if (unlikely(__pyx_v_material_functions == Py_None)) {
5110  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5111  __PYX_ERR(0, 161, __pyx_L1_error)
5112  }
5113  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 161, __pyx_L1_error)
5114  __Pyx_GOTREF(__pyx_t_19);
5115  __pyx_t_15 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_19); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 161, __pyx_L1_error)
5116  __Pyx_GOTREF(__pyx_t_15);
5117  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
5118  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 161, __pyx_L1_error)
5119  __Pyx_GOTREF(__pyx_t_19);
5120  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 161, __pyx_L1_error)
5121  __Pyx_GOTREF(__pyx_t_18);
5122  __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 161, __pyx_L1_error)
5123  __Pyx_GOTREF(__pyx_t_16);
5124  __Pyx_GIVEREF(__pyx_t_19);
5125  PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_19);
5126  __Pyx_GIVEREF(__pyx_t_18);
5127  PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_18);
5128  __pyx_t_19 = 0;
5129  __pyx_t_18 = 0;
5130  __pyx_t_18 = __Pyx_PyObject_GetItem(__pyx_t_15, __pyx_t_16); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 161, __pyx_L1_error)
5131  __Pyx_GOTREF(__pyx_t_18);
5132  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
5133  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
5134  if (unlikely(__pyx_v_material_functions == Py_None)) {
5135  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5136  __PYX_ERR(0, 161, __pyx_L1_error)
5137  }
5138  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 161, __pyx_L1_error)
5139  __Pyx_GOTREF(__pyx_t_16);
5140  __pyx_t_15 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_16); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 161, __pyx_L1_error)
5141  __Pyx_GOTREF(__pyx_t_15);
5142  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
5143  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 161, __pyx_L1_error)
5144  __Pyx_GOTREF(__pyx_t_16);
5145  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 161, __pyx_L1_error)
5146  __Pyx_GOTREF(__pyx_t_19);
5147  __pyx_t_17 = PyTuple_New(2); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 161, __pyx_L1_error)
5148  __Pyx_GOTREF(__pyx_t_17);
5149  __Pyx_GIVEREF(__pyx_t_16);
5150  PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_16);
5151  __Pyx_GIVEREF(__pyx_t_19);
5152  PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_19);
5153  __pyx_t_16 = 0;
5154  __pyx_t_19 = 0;
5155  __pyx_t_19 = __Pyx_PyObject_GetItem(__pyx_t_15, __pyx_t_17); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 161, __pyx_L1_error)
5156  __Pyx_GOTREF(__pyx_t_19);
5157  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
5158  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
5159  __pyx_t_17 = PyNumber_Add(__pyx_t_18, __pyx_t_19); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 161, __pyx_L1_error)
5160  __Pyx_GOTREF(__pyx_t_17);
5161  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
5162  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
5163  __pyx_t_19 = __Pyx_PyFloat_AddObjC(__pyx_t_17, __pyx_float_1_0eneg_20, 1.0e-20, 0, 0); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 161, __pyx_L1_error)
5164  __Pyx_GOTREF(__pyx_t_19);
5165  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
5166  __pyx_t_20 = __pyx_PyFloat_AsDouble(__pyx_t_19); if (unlikely((__pyx_t_20 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 161, __pyx_L1_error)
5167  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
5168  __pyx_v_denom = __pyx_t_20;
5169 
5170  /* "subsurfaceTransportFunctions.pyx":162
5171  * numer = 2.0*material_functions[material_left][I,J]*material_functions[material_right][I,J]
5172  * denom = material_functions[material_left][I,J] + material_functions[material_right][I,J] + 1.0e-20
5173  * ebq_global_vals[ebN,k,I*nd+J] = numer/denom # <<<<<<<<<<<<<<
5174  *
5175  * ###
5176  */
5177  if (unlikely(__pyx_v_denom == 0)) {
5178  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
5179  __PYX_ERR(0, 162, __pyx_L1_error)
5180  }
5181  __pyx_t_4 = __pyx_v_ebN;
5182  __pyx_t_5 = __pyx_v_k;
5183  __pyx_t_21 = ((__pyx_v_I * __pyx_v_nd) + __pyx_v_J);
5184  __pyx_t_22 = -1;
5185  if (__pyx_t_4 < 0) {
5186  __pyx_t_4 += __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape;
5187  if (unlikely(__pyx_t_4 < 0)) __pyx_t_22 = 0;
5188  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape)) __pyx_t_22 = 0;
5189  if (__pyx_t_5 < 0) {
5190  __pyx_t_5 += __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape;
5191  if (unlikely(__pyx_t_5 < 0)) __pyx_t_22 = 1;
5192  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape)) __pyx_t_22 = 1;
5193  if (__pyx_t_21 < 0) {
5194  __pyx_t_21 += __pyx_pybuffernd_ebq_global_vals.diminfo[2].shape;
5195  if (unlikely(__pyx_t_21 < 0)) __pyx_t_22 = 2;
5196  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_ebq_global_vals.diminfo[2].shape)) __pyx_t_22 = 2;
5197  if (unlikely(__pyx_t_22 != -1)) {
5198  __Pyx_RaiseBufferIndexError(__pyx_t_22);
5199  __PYX_ERR(0, 162, __pyx_L1_error)
5200  }
5201  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides, __pyx_t_5, __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides, __pyx_t_21, __pyx_pybuffernd_ebq_global_vals.diminfo[2].strides) = (__pyx_v_numer / __pyx_v_denom);
5202  }
5203  }
5204  }
5205  }
5206 
5207  /* "subsurfaceTransportFunctions.pyx":139
5208  *
5209  *
5210  * def setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
5211  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
5212  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
5213  */
5214 
5215  /* function exit code */
5216  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5217  goto __pyx_L0;
5218  __pyx_L1_error:;
5219  __Pyx_XDECREF(__pyx_t_15);
5220  __Pyx_XDECREF(__pyx_t_16);
5221  __Pyx_XDECREF(__pyx_t_17);
5222  __Pyx_XDECREF(__pyx_t_18);
5223  __Pyx_XDECREF(__pyx_t_19);
5224  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
5225  __Pyx_PyThreadState_declare
5226  __Pyx_PyThreadState_assign
5227  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
5228  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
5229  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
5230  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
5231  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
5232  __Pyx_AddTraceback("subsurfaceTransportFunctions.setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
5233  __pyx_r = NULL;
5234  goto __pyx_L2;
5235  __pyx_L0:;
5236  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
5237  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
5238  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
5239  __pyx_L2:;
5240  __Pyx_XGIVEREF(__pyx_r);
5241  __Pyx_RefNannyFinishContext();
5242  return __pyx_r;
5243 }
5244 
5245 /* "subsurfaceTransportFunctions.pyx":165
5246  *
5247  * ###
5248  * def evaluateScalarMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
5249  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
5250  * numpy.ndarray[DTYPE_t,ndim=3] x,
5251  */
5252 
5253 /* Python wrapper */
5254 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_17evaluateScalarMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5255 static char __pyx_doc_28subsurfaceTransportFunctions_16evaluateScalarMaterialFunctionOverElements[] = "\n loop over quadrature array and evaluate function f_j(x,t) assuming element is material j\n likely little improvement right now without correct typing of material_functions\n ";
5256 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_17evaluateScalarMaterialFunctionOverElements = {"evaluateScalarMaterialFunctionOverElements", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_17evaluateScalarMaterialFunctionOverElements, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_16evaluateScalarMaterialFunctionOverElements};
5257 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_17evaluateScalarMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5258  double __pyx_v_t;
5259  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
5260  PyArrayObject *__pyx_v_x = 0;
5261  PyArrayObject *__pyx_v_q_vals = 0;
5262  PyObject *__pyx_v_material_functions = 0;
5263  int __pyx_lineno = 0;
5264  const char *__pyx_filename = NULL;
5265  int __pyx_clineno = 0;
5266  PyObject *__pyx_r = 0;
5267  __Pyx_RefNannyDeclarations
5268  __Pyx_RefNannySetupContext("evaluateScalarMaterialFunctionOverElements (wrapper)", 0);
5269  {
5270  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_x,&__pyx_n_s_q_vals,&__pyx_n_s_material_functions,0};
5271  PyObject* values[5] = {0,0,0,0,0};
5272  if (unlikely(__pyx_kwds)) {
5273  Py_ssize_t kw_args;
5274  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5275  switch (pos_args) {
5276  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5277  CYTHON_FALLTHROUGH;
5278  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5279  CYTHON_FALLTHROUGH;
5280  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5281  CYTHON_FALLTHROUGH;
5282  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5283  CYTHON_FALLTHROUGH;
5284  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5285  CYTHON_FALLTHROUGH;
5286  case 0: break;
5287  default: goto __pyx_L5_argtuple_error;
5288  }
5289  kw_args = PyDict_Size(__pyx_kwds);
5290  switch (pos_args) {
5291  case 0:
5292  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
5293  else goto __pyx_L5_argtuple_error;
5294  CYTHON_FALLTHROUGH;
5295  case 1:
5296  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
5297  else {
5298  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElements", 1, 5, 5, 1); __PYX_ERR(0, 165, __pyx_L3_error)
5299  }
5300  CYTHON_FALLTHROUGH;
5301  case 2:
5302  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
5303  else {
5304  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElements", 1, 5, 5, 2); __PYX_ERR(0, 165, __pyx_L3_error)
5305  }
5306  CYTHON_FALLTHROUGH;
5307  case 3:
5308  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_vals)) != 0)) kw_args--;
5309  else {
5310  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElements", 1, 5, 5, 3); __PYX_ERR(0, 165, __pyx_L3_error)
5311  }
5312  CYTHON_FALLTHROUGH;
5313  case 4:
5314  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
5315  else {
5316  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElements", 1, 5, 5, 4); __PYX_ERR(0, 165, __pyx_L3_error)
5317  }
5318  }
5319  if (unlikely(kw_args > 0)) {
5320  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluateScalarMaterialFunctionOverElements") < 0)) __PYX_ERR(0, 165, __pyx_L3_error)
5321  }
5322  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
5323  goto __pyx_L5_argtuple_error;
5324  } else {
5325  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5326  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5327  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5328  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5329  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5330  }
5331  __pyx_v_t = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 165, __pyx_L3_error)
5332  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[1]);
5333  __pyx_v_x = ((PyArrayObject *)values[2]);
5334  __pyx_v_q_vals = ((PyArrayObject *)values[3]);
5335  __pyx_v_material_functions = ((PyObject*)values[4]);
5336  }
5337  goto __pyx_L4_argument_unpacking_done;
5338  __pyx_L5_argtuple_error:;
5339  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElements", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 165, __pyx_L3_error)
5340  __pyx_L3_error:;
5341  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateScalarMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
5342  __Pyx_RefNannyFinishContext();
5343  return NULL;
5344  __pyx_L4_argument_unpacking_done:;
5345  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) __PYX_ERR(0, 166, __pyx_L1_error)
5346  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 167, __pyx_L1_error)
5347  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_vals), __pyx_ptype_5numpy_ndarray, 1, "q_vals", 0))) __PYX_ERR(0, 168, __pyx_L1_error)
5348  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 169, __pyx_L1_error)
5349  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_16evaluateScalarMaterialFunctionOverElements(__pyx_self, __pyx_v_t, __pyx_v_elementMaterialTypes, __pyx_v_x, __pyx_v_q_vals, __pyx_v_material_functions);
5350 
5351  /* function exit code */
5352  goto __pyx_L0;
5353  __pyx_L1_error:;
5354  __pyx_r = NULL;
5355  __pyx_L0:;
5356  __Pyx_RefNannyFinishContext();
5357  return __pyx_r;
5358 }
5359 
5360 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_16evaluateScalarMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions) {
5361  int __pyx_v_eN;
5362  int __pyx_v_k;
5363  int __pyx_v_material;
5364  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
5365  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
5366  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_vals;
5367  __Pyx_Buffer __pyx_pybuffer_q_vals;
5368  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
5369  __Pyx_Buffer __pyx_pybuffer_x;
5370  PyObject *__pyx_r = NULL;
5371  __Pyx_RefNannyDeclarations
5372  npy_intp __pyx_t_1;
5373  npy_intp __pyx_t_2;
5374  int __pyx_t_3;
5375  Py_ssize_t __pyx_t_4;
5376  int __pyx_t_5;
5377  npy_intp __pyx_t_6;
5378  npy_intp __pyx_t_7;
5379  PyObject *__pyx_t_8 = NULL;
5380  PyObject *__pyx_t_9 = NULL;
5381  PyObject *__pyx_t_10 = NULL;
5382  PyObject *__pyx_t_11 = NULL;
5383  PyObject *__pyx_t_12 = NULL;
5384  int __pyx_t_13;
5385  PyObject *__pyx_t_14 = NULL;
5386  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_15;
5387  Py_ssize_t __pyx_t_16;
5388  int __pyx_lineno = 0;
5389  const char *__pyx_filename = NULL;
5390  int __pyx_clineno = 0;
5391  __Pyx_RefNannySetupContext("evaluateScalarMaterialFunctionOverElements", 0);
5392  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
5393  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
5394  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
5395  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
5396  __pyx_pybuffer_x.pybuffer.buf = NULL;
5397  __pyx_pybuffer_x.refcount = 0;
5398  __pyx_pybuffernd_x.data = NULL;
5399  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
5400  __pyx_pybuffer_q_vals.pybuffer.buf = NULL;
5401  __pyx_pybuffer_q_vals.refcount = 0;
5402  __pyx_pybuffernd_q_vals.data = NULL;
5403  __pyx_pybuffernd_q_vals.rcbuffer = &__pyx_pybuffer_q_vals;
5404  {
5405  __Pyx_BufFmt_StackElem __pyx_stack[1];
5406  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 165, __pyx_L1_error)
5407  }
5408  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
5409  {
5410  __Pyx_BufFmt_StackElem __pyx_stack[1];
5411  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 165, __pyx_L1_error)
5412  }
5413  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2];
5414  {
5415  __Pyx_BufFmt_StackElem __pyx_stack[1];
5416  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 165, __pyx_L1_error)
5417  }
5418  __pyx_pybuffernd_q_vals.diminfo[0].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_vals.diminfo[0].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_vals.diminfo[1].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_vals.diminfo[1].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[1];
5419 
5420  /* "subsurfaceTransportFunctions.pyx":175
5421  * """
5422  * cdef int eN,k,material
5423  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
5424  * material = elementMaterialTypes[eN]
5425  * for k in range(x.shape[1]):
5426  */
5427  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
5428  __pyx_t_2 = __pyx_t_1;
5429  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
5430  __pyx_v_eN = __pyx_t_3;
5431 
5432  /* "subsurfaceTransportFunctions.pyx":176
5433  * cdef int eN,k,material
5434  * for eN in range(x.shape[0]):
5435  * material = elementMaterialTypes[eN] # <<<<<<<<<<<<<<
5436  * for k in range(x.shape[1]):
5437  * q_vals[eN,k] = material_functions[material](x[eN,k],t)
5438  */
5439  __pyx_t_4 = __pyx_v_eN;
5440  __pyx_t_5 = -1;
5441  if (__pyx_t_4 < 0) {
5442  __pyx_t_4 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
5443  if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
5444  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_5 = 0;
5445  if (unlikely(__pyx_t_5 != -1)) {
5446  __Pyx_RaiseBufferIndexError(__pyx_t_5);
5447  __PYX_ERR(0, 176, __pyx_L1_error)
5448  }
5449  __pyx_v_material = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
5450 
5451  /* "subsurfaceTransportFunctions.pyx":177
5452  * for eN in range(x.shape[0]):
5453  * material = elementMaterialTypes[eN]
5454  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
5455  * q_vals[eN,k] = material_functions[material](x[eN,k],t)
5456  *
5457  */
5458  __pyx_t_6 = (__pyx_v_x->dimensions[1]);
5459  __pyx_t_7 = __pyx_t_6;
5460  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_7; __pyx_t_5+=1) {
5461  __pyx_v_k = __pyx_t_5;
5462 
5463  /* "subsurfaceTransportFunctions.pyx":178
5464  * material = elementMaterialTypes[eN]
5465  * for k in range(x.shape[1]):
5466  * q_vals[eN,k] = material_functions[material](x[eN,k],t) # <<<<<<<<<<<<<<
5467  *
5468  * def evaluateVectorMaterialFunctionOverElements(double t,
5469  */
5470  if (unlikely(__pyx_v_material_functions == Py_None)) {
5471  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5472  __PYX_ERR(0, 178, __pyx_L1_error)
5473  }
5474  __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_material); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 178, __pyx_L1_error)
5475  __Pyx_GOTREF(__pyx_t_9);
5476  __pyx_t_10 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 178, __pyx_L1_error)
5477  __Pyx_GOTREF(__pyx_t_10);
5478  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
5479  __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 178, __pyx_L1_error)
5480  __Pyx_GOTREF(__pyx_t_9);
5481  __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 178, __pyx_L1_error)
5482  __Pyx_GOTREF(__pyx_t_11);
5483  __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 178, __pyx_L1_error)
5484  __Pyx_GOTREF(__pyx_t_12);
5485  __Pyx_GIVEREF(__pyx_t_9);
5486  PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_9);
5487  __Pyx_GIVEREF(__pyx_t_11);
5488  PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_11);
5489  __pyx_t_9 = 0;
5490  __pyx_t_11 = 0;
5491  __pyx_t_11 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_12); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 178, __pyx_L1_error)
5492  __Pyx_GOTREF(__pyx_t_11);
5493  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
5494  __pyx_t_12 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 178, __pyx_L1_error)
5495  __Pyx_GOTREF(__pyx_t_12);
5496  __pyx_t_9 = NULL;
5497  __pyx_t_13 = 0;
5498  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
5499  __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_10);
5500  if (likely(__pyx_t_9)) {
5501  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
5502  __Pyx_INCREF(__pyx_t_9);
5503  __Pyx_INCREF(function);
5504  __Pyx_DECREF_SET(__pyx_t_10, function);
5505  __pyx_t_13 = 1;
5506  }
5507  }
5508  #if CYTHON_FAST_PYCALL
5509  if (PyFunction_Check(__pyx_t_10)) {
5510  PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_11, __pyx_t_12};
5511  __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 178, __pyx_L1_error)
5512  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
5513  __Pyx_GOTREF(__pyx_t_8);
5514  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
5515  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
5516  } else
5517  #endif
5518  #if CYTHON_FAST_PYCCALL
5519  if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
5520  PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_11, __pyx_t_12};
5521  __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 178, __pyx_L1_error)
5522  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
5523  __Pyx_GOTREF(__pyx_t_8);
5524  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
5525  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
5526  } else
5527  #endif
5528  {
5529  __pyx_t_14 = PyTuple_New(2+__pyx_t_13); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 178, __pyx_L1_error)
5530  __Pyx_GOTREF(__pyx_t_14);
5531  if (__pyx_t_9) {
5532  __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_9); __pyx_t_9 = NULL;
5533  }
5534  __Pyx_GIVEREF(__pyx_t_11);
5535  PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_13, __pyx_t_11);
5536  __Pyx_GIVEREF(__pyx_t_12);
5537  PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_13, __pyx_t_12);
5538  __pyx_t_11 = 0;
5539  __pyx_t_12 = 0;
5540  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_14, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 178, __pyx_L1_error)
5541  __Pyx_GOTREF(__pyx_t_8);
5542  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
5543  }
5544  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5545  __pyx_t_15 = __pyx_PyFloat_AsDouble(__pyx_t_8); if (unlikely((__pyx_t_15 == ((npy_double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 178, __pyx_L1_error)
5546  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5547  __pyx_t_4 = __pyx_v_eN;
5548  __pyx_t_16 = __pyx_v_k;
5549  __pyx_t_13 = -1;
5550  if (__pyx_t_4 < 0) {
5551  __pyx_t_4 += __pyx_pybuffernd_q_vals.diminfo[0].shape;
5552  if (unlikely(__pyx_t_4 < 0)) __pyx_t_13 = 0;
5553  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_q_vals.diminfo[0].shape)) __pyx_t_13 = 0;
5554  if (__pyx_t_16 < 0) {
5555  __pyx_t_16 += __pyx_pybuffernd_q_vals.diminfo[1].shape;
5556  if (unlikely(__pyx_t_16 < 0)) __pyx_t_13 = 1;
5557  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_q_vals.diminfo[1].shape)) __pyx_t_13 = 1;
5558  if (unlikely(__pyx_t_13 != -1)) {
5559  __Pyx_RaiseBufferIndexError(__pyx_t_13);
5560  __PYX_ERR(0, 178, __pyx_L1_error)
5561  }
5562  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_q_vals.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_q_vals.diminfo[1].strides) = __pyx_t_15;
5563  }
5564  }
5565 
5566  /* "subsurfaceTransportFunctions.pyx":165
5567  *
5568  * ###
5569  * def evaluateScalarMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
5570  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
5571  * numpy.ndarray[DTYPE_t,ndim=3] x,
5572  */
5573 
5574  /* function exit code */
5575  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5576  goto __pyx_L0;
5577  __pyx_L1_error:;
5578  __Pyx_XDECREF(__pyx_t_8);
5579  __Pyx_XDECREF(__pyx_t_9);
5580  __Pyx_XDECREF(__pyx_t_10);
5581  __Pyx_XDECREF(__pyx_t_11);
5582  __Pyx_XDECREF(__pyx_t_12);
5583  __Pyx_XDECREF(__pyx_t_14);
5584  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
5585  __Pyx_PyThreadState_declare
5586  __Pyx_PyThreadState_assign
5587  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
5588  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
5589  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
5590  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
5591  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
5592  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateScalarMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
5593  __pyx_r = NULL;
5594  goto __pyx_L2;
5595  __pyx_L0:;
5596  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
5597  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
5598  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
5599  __pyx_L2:;
5600  __Pyx_XGIVEREF(__pyx_r);
5601  __Pyx_RefNannyFinishContext();
5602  return __pyx_r;
5603 }
5604 
5605 /* "subsurfaceTransportFunctions.pyx":180
5606  * q_vals[eN,k] = material_functions[material](x[eN,k],t)
5607  *
5608  * def evaluateVectorMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
5609  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
5610  * numpy.ndarray[DTYPE_t,ndim=3] x,
5611  */
5612 
5613 /* Python wrapper */
5614 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_19evaluateVectorMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5615 static char __pyx_doc_28subsurfaceTransportFunctions_18evaluateVectorMaterialFunctionOverElements[] = "\n loop over quadrature array and evaluate function \013ec f_j(x,t) assuming element is material j\n ";
5616 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_19evaluateVectorMaterialFunctionOverElements = {"evaluateVectorMaterialFunctionOverElements", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_19evaluateVectorMaterialFunctionOverElements, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_18evaluateVectorMaterialFunctionOverElements};
5617 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_19evaluateVectorMaterialFunctionOverElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5618  double __pyx_v_t;
5619  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
5620  PyArrayObject *__pyx_v_x = 0;
5621  PyArrayObject *__pyx_v_q_vals = 0;
5622  PyObject *__pyx_v_material_functions = 0;
5623  int __pyx_lineno = 0;
5624  const char *__pyx_filename = NULL;
5625  int __pyx_clineno = 0;
5626  PyObject *__pyx_r = 0;
5627  __Pyx_RefNannyDeclarations
5628  __Pyx_RefNannySetupContext("evaluateVectorMaterialFunctionOverElements (wrapper)", 0);
5629  {
5630  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_x,&__pyx_n_s_q_vals,&__pyx_n_s_material_functions,0};
5631  PyObject* values[5] = {0,0,0,0,0};
5632  if (unlikely(__pyx_kwds)) {
5633  Py_ssize_t kw_args;
5634  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5635  switch (pos_args) {
5636  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5637  CYTHON_FALLTHROUGH;
5638  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5639  CYTHON_FALLTHROUGH;
5640  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5641  CYTHON_FALLTHROUGH;
5642  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5643  CYTHON_FALLTHROUGH;
5644  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5645  CYTHON_FALLTHROUGH;
5646  case 0: break;
5647  default: goto __pyx_L5_argtuple_error;
5648  }
5649  kw_args = PyDict_Size(__pyx_kwds);
5650  switch (pos_args) {
5651  case 0:
5652  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
5653  else goto __pyx_L5_argtuple_error;
5654  CYTHON_FALLTHROUGH;
5655  case 1:
5656  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
5657  else {
5658  __Pyx_RaiseArgtupleInvalid("evaluateVectorMaterialFunctionOverElements", 1, 5, 5, 1); __PYX_ERR(0, 180, __pyx_L3_error)
5659  }
5660  CYTHON_FALLTHROUGH;
5661  case 2:
5662  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
5663  else {
5664  __Pyx_RaiseArgtupleInvalid("evaluateVectorMaterialFunctionOverElements", 1, 5, 5, 2); __PYX_ERR(0, 180, __pyx_L3_error)
5665  }
5666  CYTHON_FALLTHROUGH;
5667  case 3:
5668  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_vals)) != 0)) kw_args--;
5669  else {
5670  __Pyx_RaiseArgtupleInvalid("evaluateVectorMaterialFunctionOverElements", 1, 5, 5, 3); __PYX_ERR(0, 180, __pyx_L3_error)
5671  }
5672  CYTHON_FALLTHROUGH;
5673  case 4:
5674  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
5675  else {
5676  __Pyx_RaiseArgtupleInvalid("evaluateVectorMaterialFunctionOverElements", 1, 5, 5, 4); __PYX_ERR(0, 180, __pyx_L3_error)
5677  }
5678  }
5679  if (unlikely(kw_args > 0)) {
5680  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluateVectorMaterialFunctionOverElements") < 0)) __PYX_ERR(0, 180, __pyx_L3_error)
5681  }
5682  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
5683  goto __pyx_L5_argtuple_error;
5684  } else {
5685  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5686  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5687  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5688  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5689  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5690  }
5691  __pyx_v_t = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 180, __pyx_L3_error)
5692  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[1]);
5693  __pyx_v_x = ((PyArrayObject *)values[2]);
5694  __pyx_v_q_vals = ((PyArrayObject *)values[3]);
5695  __pyx_v_material_functions = ((PyObject*)values[4]);
5696  }
5697  goto __pyx_L4_argument_unpacking_done;
5698  __pyx_L5_argtuple_error:;
5699  __Pyx_RaiseArgtupleInvalid("evaluateVectorMaterialFunctionOverElements", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 180, __pyx_L3_error)
5700  __pyx_L3_error:;
5701  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateVectorMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
5702  __Pyx_RefNannyFinishContext();
5703  return NULL;
5704  __pyx_L4_argument_unpacking_done:;
5705  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) __PYX_ERR(0, 181, __pyx_L1_error)
5706  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 182, __pyx_L1_error)
5707  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_vals), __pyx_ptype_5numpy_ndarray, 1, "q_vals", 0))) __PYX_ERR(0, 183, __pyx_L1_error)
5708  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 184, __pyx_L1_error)
5709  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_18evaluateVectorMaterialFunctionOverElements(__pyx_self, __pyx_v_t, __pyx_v_elementMaterialTypes, __pyx_v_x, __pyx_v_q_vals, __pyx_v_material_functions);
5710 
5711  /* function exit code */
5712  goto __pyx_L0;
5713  __pyx_L1_error:;
5714  __pyx_r = NULL;
5715  __pyx_L0:;
5716  __Pyx_RefNannyFinishContext();
5717  return __pyx_r;
5718 }
5719 
5720 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_18evaluateVectorMaterialFunctionOverElements(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_q_vals, PyObject *__pyx_v_material_functions) {
5721  int __pyx_v_eN;
5722  int __pyx_v_k;
5723  int __pyx_v_material;
5724  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
5725  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
5726  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_vals;
5727  __Pyx_Buffer __pyx_pybuffer_q_vals;
5728  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
5729  __Pyx_Buffer __pyx_pybuffer_x;
5730  PyObject *__pyx_r = NULL;
5731  __Pyx_RefNannyDeclarations
5732  npy_intp __pyx_t_1;
5733  npy_intp __pyx_t_2;
5734  int __pyx_t_3;
5735  Py_ssize_t __pyx_t_4;
5736  int __pyx_t_5;
5737  npy_intp __pyx_t_6;
5738  npy_intp __pyx_t_7;
5739  PyObject *__pyx_t_8 = NULL;
5740  PyObject *__pyx_t_9 = NULL;
5741  PyObject *__pyx_t_10 = NULL;
5742  PyObject *__pyx_t_11 = NULL;
5743  PyObject *__pyx_t_12 = NULL;
5744  int __pyx_t_13;
5745  PyObject *__pyx_t_14 = NULL;
5746  int __pyx_lineno = 0;
5747  const char *__pyx_filename = NULL;
5748  int __pyx_clineno = 0;
5749  __Pyx_RefNannySetupContext("evaluateVectorMaterialFunctionOverElements", 0);
5750  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
5751  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
5752  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
5753  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
5754  __pyx_pybuffer_x.pybuffer.buf = NULL;
5755  __pyx_pybuffer_x.refcount = 0;
5756  __pyx_pybuffernd_x.data = NULL;
5757  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
5758  __pyx_pybuffer_q_vals.pybuffer.buf = NULL;
5759  __pyx_pybuffer_q_vals.refcount = 0;
5760  __pyx_pybuffernd_q_vals.data = NULL;
5761  __pyx_pybuffernd_q_vals.rcbuffer = &__pyx_pybuffer_q_vals;
5762  {
5763  __Pyx_BufFmt_StackElem __pyx_stack[1];
5764  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 180, __pyx_L1_error)
5765  }
5766  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
5767  {
5768  __Pyx_BufFmt_StackElem __pyx_stack[1];
5769  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 180, __pyx_L1_error)
5770  }
5771  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2];
5772  {
5773  __Pyx_BufFmt_StackElem __pyx_stack[1];
5774  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 180, __pyx_L1_error)
5775  }
5776  __pyx_pybuffernd_q_vals.diminfo[0].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_vals.diminfo[0].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_vals.diminfo[1].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_vals.diminfo[1].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_vals.diminfo[2].strides = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_vals.diminfo[2].shape = __pyx_pybuffernd_q_vals.rcbuffer->pybuffer.shape[2];
5777 
5778  /* "subsurfaceTransportFunctions.pyx":189
5779  * """
5780  * cdef int eN,k,material
5781  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
5782  * material = elementMaterialTypes[eN]
5783  * for k in range(x.shape[1]):
5784  */
5785  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
5786  __pyx_t_2 = __pyx_t_1;
5787  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
5788  __pyx_v_eN = __pyx_t_3;
5789 
5790  /* "subsurfaceTransportFunctions.pyx":190
5791  * cdef int eN,k,material
5792  * for eN in range(x.shape[0]):
5793  * material = elementMaterialTypes[eN] # <<<<<<<<<<<<<<
5794  * for k in range(x.shape[1]):
5795  * q_vals[eN,k,:] = material_functions[material](x[eN,k],t).flat
5796  */
5797  __pyx_t_4 = __pyx_v_eN;
5798  __pyx_t_5 = -1;
5799  if (__pyx_t_4 < 0) {
5800  __pyx_t_4 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
5801  if (unlikely(__pyx_t_4 < 0)) __pyx_t_5 = 0;
5802  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_5 = 0;
5803  if (unlikely(__pyx_t_5 != -1)) {
5804  __Pyx_RaiseBufferIndexError(__pyx_t_5);
5805  __PYX_ERR(0, 190, __pyx_L1_error)
5806  }
5807  __pyx_v_material = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
5808 
5809  /* "subsurfaceTransportFunctions.pyx":191
5810  * for eN in range(x.shape[0]):
5811  * material = elementMaterialTypes[eN]
5812  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
5813  * q_vals[eN,k,:] = material_functions[material](x[eN,k],t).flat
5814  *
5815  */
5816  __pyx_t_6 = (__pyx_v_x->dimensions[1]);
5817  __pyx_t_7 = __pyx_t_6;
5818  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_7; __pyx_t_5+=1) {
5819  __pyx_v_k = __pyx_t_5;
5820 
5821  /* "subsurfaceTransportFunctions.pyx":192
5822  * material = elementMaterialTypes[eN]
5823  * for k in range(x.shape[1]):
5824  * q_vals[eN,k,:] = material_functions[material](x[eN,k],t).flat # <<<<<<<<<<<<<<
5825  *
5826  *
5827  */
5828  if (unlikely(__pyx_v_material_functions == Py_None)) {
5829  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
5830  __PYX_ERR(0, 192, __pyx_L1_error)
5831  }
5832  __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_material); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 192, __pyx_L1_error)
5833  __Pyx_GOTREF(__pyx_t_9);
5834  __pyx_t_10 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 192, __pyx_L1_error)
5835  __Pyx_GOTREF(__pyx_t_10);
5836  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
5837  __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 192, __pyx_L1_error)
5838  __Pyx_GOTREF(__pyx_t_9);
5839  __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 192, __pyx_L1_error)
5840  __Pyx_GOTREF(__pyx_t_11);
5841  __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 192, __pyx_L1_error)
5842  __Pyx_GOTREF(__pyx_t_12);
5843  __Pyx_GIVEREF(__pyx_t_9);
5844  PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_9);
5845  __Pyx_GIVEREF(__pyx_t_11);
5846  PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_11);
5847  __pyx_t_9 = 0;
5848  __pyx_t_11 = 0;
5849  __pyx_t_11 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_12); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 192, __pyx_L1_error)
5850  __Pyx_GOTREF(__pyx_t_11);
5851  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
5852  __pyx_t_12 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 192, __pyx_L1_error)
5853  __Pyx_GOTREF(__pyx_t_12);
5854  __pyx_t_9 = NULL;
5855  __pyx_t_13 = 0;
5856  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
5857  __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_10);
5858  if (likely(__pyx_t_9)) {
5859  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
5860  __Pyx_INCREF(__pyx_t_9);
5861  __Pyx_INCREF(function);
5862  __Pyx_DECREF_SET(__pyx_t_10, function);
5863  __pyx_t_13 = 1;
5864  }
5865  }
5866  #if CYTHON_FAST_PYCALL
5867  if (PyFunction_Check(__pyx_t_10)) {
5868  PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_11, __pyx_t_12};
5869  __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 192, __pyx_L1_error)
5870  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
5871  __Pyx_GOTREF(__pyx_t_8);
5872  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
5873  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
5874  } else
5875  #endif
5876  #if CYTHON_FAST_PYCCALL
5877  if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
5878  PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_11, __pyx_t_12};
5879  __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 192, __pyx_L1_error)
5880  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
5881  __Pyx_GOTREF(__pyx_t_8);
5882  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
5883  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
5884  } else
5885  #endif
5886  {
5887  __pyx_t_14 = PyTuple_New(2+__pyx_t_13); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 192, __pyx_L1_error)
5888  __Pyx_GOTREF(__pyx_t_14);
5889  if (__pyx_t_9) {
5890  __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_9); __pyx_t_9 = NULL;
5891  }
5892  __Pyx_GIVEREF(__pyx_t_11);
5893  PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_13, __pyx_t_11);
5894  __Pyx_GIVEREF(__pyx_t_12);
5895  PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_13, __pyx_t_12);
5896  __pyx_t_11 = 0;
5897  __pyx_t_12 = 0;
5898  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_14, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 192, __pyx_L1_error)
5899  __Pyx_GOTREF(__pyx_t_8);
5900  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
5901  }
5902  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5903  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_flat); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 192, __pyx_L1_error)
5904  __Pyx_GOTREF(__pyx_t_10);
5905  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
5906  __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 192, __pyx_L1_error)
5907  __Pyx_GOTREF(__pyx_t_8);
5908  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 192, __pyx_L1_error)
5909  __Pyx_GOTREF(__pyx_t_14);
5910  __pyx_t_12 = PyTuple_New(3); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 192, __pyx_L1_error)
5911  __Pyx_GOTREF(__pyx_t_12);
5912  __Pyx_GIVEREF(__pyx_t_8);
5913  PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_8);
5914  __Pyx_GIVEREF(__pyx_t_14);
5915  PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_14);
5916  __Pyx_INCREF(__pyx_slice_);
5917  __Pyx_GIVEREF(__pyx_slice_);
5918  PyTuple_SET_ITEM(__pyx_t_12, 2, __pyx_slice_);
5919  __pyx_t_8 = 0;
5920  __pyx_t_14 = 0;
5921  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_q_vals), __pyx_t_12, __pyx_t_10) < 0)) __PYX_ERR(0, 192, __pyx_L1_error)
5922  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
5923  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
5924  }
5925  }
5926 
5927  /* "subsurfaceTransportFunctions.pyx":180
5928  * q_vals[eN,k] = material_functions[material](x[eN,k],t)
5929  *
5930  * def evaluateVectorMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
5931  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
5932  * numpy.ndarray[DTYPE_t,ndim=3] x,
5933  */
5934 
5935  /* function exit code */
5936  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5937  goto __pyx_L0;
5938  __pyx_L1_error:;
5939  __Pyx_XDECREF(__pyx_t_8);
5940  __Pyx_XDECREF(__pyx_t_9);
5941  __Pyx_XDECREF(__pyx_t_10);
5942  __Pyx_XDECREF(__pyx_t_11);
5943  __Pyx_XDECREF(__pyx_t_12);
5944  __Pyx_XDECREF(__pyx_t_14);
5945  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
5946  __Pyx_PyThreadState_declare
5947  __Pyx_PyThreadState_assign
5948  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
5949  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
5950  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
5951  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
5952  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
5953  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateVectorMaterialFunctionOverElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
5954  __pyx_r = NULL;
5955  goto __pyx_L2;
5956  __pyx_L0:;
5957  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
5958  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_vals.rcbuffer->pybuffer);
5959  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
5960  __pyx_L2:;
5961  __Pyx_XGIVEREF(__pyx_r);
5962  __Pyx_RefNannyFinishContext();
5963  return __pyx_r;
5964 }
5965 
5966 /* "subsurfaceTransportFunctions.pyx":195
5967  *
5968  *
5969  * def evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
5970  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
5971  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
5972  */
5973 
5974 /* Python wrapper */
5975 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_21evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5976 static char __pyx_doc_28subsurfaceTransportFunctions_20evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage[] = "\n loop over quadrature array and evaluate function f(x,t) = 0.5(f^L_j(x,t)+f^R_k(x,t)) assuming element on left \n is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
5977 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_21evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage = {"evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_21evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_20evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage};
5978 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_21evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5979  double __pyx_v_t;
5980  PyArrayObject *__pyx_v_elementBoundariesArray = 0;
5981  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
5982  PyArrayObject *__pyx_v_x = 0;
5983  PyArrayObject *__pyx_v_ebq_vals = 0;
5984  PyObject *__pyx_v_material_functions = 0;
5985  int __pyx_lineno = 0;
5986  const char *__pyx_filename = NULL;
5987  int __pyx_clineno = 0;
5988  PyObject *__pyx_r = 0;
5989  __Pyx_RefNannyDeclarations
5990  __Pyx_RefNannySetupContext("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage (wrapper)", 0);
5991  {
5992  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_x,&__pyx_n_s_ebq_vals,&__pyx_n_s_material_functions,0};
5993  PyObject* values[6] = {0,0,0,0,0,0};
5994  if (unlikely(__pyx_kwds)) {
5995  Py_ssize_t kw_args;
5996  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5997  switch (pos_args) {
5998  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
5999  CYTHON_FALLTHROUGH;
6000  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6001  CYTHON_FALLTHROUGH;
6002  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6003  CYTHON_FALLTHROUGH;
6004  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6005  CYTHON_FALLTHROUGH;
6006  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6007  CYTHON_FALLTHROUGH;
6008  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6009  CYTHON_FALLTHROUGH;
6010  case 0: break;
6011  default: goto __pyx_L5_argtuple_error;
6012  }
6013  kw_args = PyDict_Size(__pyx_kwds);
6014  switch (pos_args) {
6015  case 0:
6016  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
6017  else goto __pyx_L5_argtuple_error;
6018  CYTHON_FALLTHROUGH;
6019  case 1:
6020  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
6021  else {
6022  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 6, 6, 1); __PYX_ERR(0, 195, __pyx_L3_error)
6023  }
6024  CYTHON_FALLTHROUGH;
6025  case 2:
6026  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
6027  else {
6028  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 6, 6, 2); __PYX_ERR(0, 195, __pyx_L3_error)
6029  }
6030  CYTHON_FALLTHROUGH;
6031  case 3:
6032  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
6033  else {
6034  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 6, 6, 3); __PYX_ERR(0, 195, __pyx_L3_error)
6035  }
6036  CYTHON_FALLTHROUGH;
6037  case 4:
6038  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ebq_vals)) != 0)) kw_args--;
6039  else {
6040  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 6, 6, 4); __PYX_ERR(0, 195, __pyx_L3_error)
6041  }
6042  CYTHON_FALLTHROUGH;
6043  case 5:
6044  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
6045  else {
6046  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 6, 6, 5); __PYX_ERR(0, 195, __pyx_L3_error)
6047  }
6048  }
6049  if (unlikely(kw_args > 0)) {
6050  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage") < 0)) __PYX_ERR(0, 195, __pyx_L3_error)
6051  }
6052  } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
6053  goto __pyx_L5_argtuple_error;
6054  } else {
6055  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6056  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6057  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6058  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6059  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6060  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
6061  }
6062  __pyx_v_t = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 195, __pyx_L3_error)
6063  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[1]);
6064  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[2]);
6065  __pyx_v_x = ((PyArrayObject *)values[3]);
6066  __pyx_v_ebq_vals = ((PyArrayObject *)values[4]);
6067  __pyx_v_material_functions = ((PyObject*)values[5]);
6068  }
6069  goto __pyx_L4_argument_unpacking_done;
6070  __pyx_L5_argtuple_error:;
6071  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 195, __pyx_L3_error)
6072  __pyx_L3_error:;
6073  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
6074  __Pyx_RefNannyFinishContext();
6075  return NULL;
6076  __pyx_L4_argument_unpacking_done:;
6077  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) __PYX_ERR(0, 196, __pyx_L1_error)
6078  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) __PYX_ERR(0, 197, __pyx_L1_error)
6079  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 198, __pyx_L1_error)
6080  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_vals", 0))) __PYX_ERR(0, 199, __pyx_L1_error)
6081  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 200, __pyx_L1_error)
6082  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_20evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(__pyx_self, __pyx_v_t, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_x, __pyx_v_ebq_vals, __pyx_v_material_functions);
6083 
6084  /* function exit code */
6085  goto __pyx_L0;
6086  __pyx_L1_error:;
6087  __pyx_r = NULL;
6088  __pyx_L0:;
6089  __Pyx_RefNannyFinishContext();
6090  return __pyx_r;
6091 }
6092 
6093 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_20evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions) {
6094  int __pyx_v_eN;
6095  int __pyx_v_ebN;
6096  int __pyx_v_ebN_local;
6097  int __pyx_v_k;
6098  int __pyx_v_material_left;
6099  int __pyx_v_material_right;
6100  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_vals;
6101  __Pyx_Buffer __pyx_pybuffer_ebq_vals;
6102  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
6103  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
6104  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
6105  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
6106  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
6107  __Pyx_Buffer __pyx_pybuffer_x;
6108  PyObject *__pyx_r = NULL;
6109  __Pyx_RefNannyDeclarations
6110  npy_intp __pyx_t_1;
6111  npy_intp __pyx_t_2;
6112  int __pyx_t_3;
6113  npy_intp __pyx_t_4;
6114  npy_intp __pyx_t_5;
6115  int __pyx_t_6;
6116  Py_ssize_t __pyx_t_7;
6117  Py_ssize_t __pyx_t_8;
6118  int __pyx_t_9;
6119  npy_intp __pyx_t_10;
6120  npy_intp __pyx_t_11;
6121  PyObject *__pyx_t_12 = NULL;
6122  PyObject *__pyx_t_13 = NULL;
6123  PyObject *__pyx_t_14 = NULL;
6124  PyObject *__pyx_t_15 = NULL;
6125  PyObject *__pyx_t_16 = NULL;
6126  PyObject *__pyx_t_17 = NULL;
6127  int __pyx_t_18;
6128  PyObject *__pyx_t_19 = NULL;
6129  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_20;
6130  Py_ssize_t __pyx_t_21;
6131  int __pyx_lineno = 0;
6132  const char *__pyx_filename = NULL;
6133  int __pyx_clineno = 0;
6134  __Pyx_RefNannySetupContext("evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", 0);
6135  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
6136  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
6137  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
6138  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
6139  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
6140  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
6141  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
6142  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
6143  __pyx_pybuffer_x.pybuffer.buf = NULL;
6144  __pyx_pybuffer_x.refcount = 0;
6145  __pyx_pybuffernd_x.data = NULL;
6146  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
6147  __pyx_pybuffer_ebq_vals.pybuffer.buf = NULL;
6148  __pyx_pybuffer_ebq_vals.refcount = 0;
6149  __pyx_pybuffernd_ebq_vals.data = NULL;
6150  __pyx_pybuffernd_ebq_vals.rcbuffer = &__pyx_pybuffer_ebq_vals;
6151  {
6152  __Pyx_BufFmt_StackElem __pyx_stack[1];
6153  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 195, __pyx_L1_error)
6154  }
6155  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
6156  {
6157  __Pyx_BufFmt_StackElem __pyx_stack[1];
6158  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 195, __pyx_L1_error)
6159  }
6160  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
6161  {
6162  __Pyx_BufFmt_StackElem __pyx_stack[1];
6163  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 195, __pyx_L1_error)
6164  }
6165  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_x.diminfo[3].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_x.diminfo[3].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[3];
6166  {
6167  __Pyx_BufFmt_StackElem __pyx_stack[1];
6168  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 195, __pyx_L1_error)
6169  }
6170  __pyx_pybuffernd_ebq_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_ebq_vals.diminfo[2].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_ebq_vals.diminfo[2].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[2];
6171 
6172  /* "subsurfaceTransportFunctions.pyx":210
6173  * cdef int eN,ebN,ebN_local,k,material_left,material_right
6174  *
6175  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
6176  * for ebN_local in range(x.shape[1]):
6177  * ebN = elementBoundariesArray[eN,ebN_local]
6178  */
6179  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
6180  __pyx_t_2 = __pyx_t_1;
6181  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
6182  __pyx_v_eN = __pyx_t_3;
6183 
6184  /* "subsurfaceTransportFunctions.pyx":211
6185  *
6186  * for eN in range(x.shape[0]):
6187  * for ebN_local in range(x.shape[1]): # <<<<<<<<<<<<<<
6188  * ebN = elementBoundariesArray[eN,ebN_local]
6189  * material_left = elementBoundaryTypes[ebN,0]
6190  */
6191  __pyx_t_4 = (__pyx_v_x->dimensions[1]);
6192  __pyx_t_5 = __pyx_t_4;
6193  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
6194  __pyx_v_ebN_local = __pyx_t_6;
6195 
6196  /* "subsurfaceTransportFunctions.pyx":212
6197  * for eN in range(x.shape[0]):
6198  * for ebN_local in range(x.shape[1]):
6199  * ebN = elementBoundariesArray[eN,ebN_local] # <<<<<<<<<<<<<<
6200  * material_left = elementBoundaryTypes[ebN,0]
6201  * material_right= elementBoundaryTypes[ebN,1]
6202  */
6203  __pyx_t_7 = __pyx_v_eN;
6204  __pyx_t_8 = __pyx_v_ebN_local;
6205  __pyx_t_9 = -1;
6206  if (__pyx_t_7 < 0) {
6207  __pyx_t_7 += __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape;
6208  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
6209  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape)) __pyx_t_9 = 0;
6210  if (__pyx_t_8 < 0) {
6211  __pyx_t_8 += __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape;
6212  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
6213  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape)) __pyx_t_9 = 1;
6214  if (unlikely(__pyx_t_9 != -1)) {
6215  __Pyx_RaiseBufferIndexError(__pyx_t_9);
6216  __PYX_ERR(0, 212, __pyx_L1_error)
6217  }
6218  __pyx_v_ebN = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides));
6219 
6220  /* "subsurfaceTransportFunctions.pyx":213
6221  * for ebN_local in range(x.shape[1]):
6222  * ebN = elementBoundariesArray[eN,ebN_local]
6223  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
6224  * material_right= elementBoundaryTypes[ebN,1]
6225  * for k in range(x.shape[2]):
6226  */
6227  __pyx_t_8 = __pyx_v_ebN;
6228  __pyx_t_7 = 0;
6229  __pyx_t_9 = -1;
6230  if (__pyx_t_8 < 0) {
6231  __pyx_t_8 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
6232  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0;
6233  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_9 = 0;
6234  if (__pyx_t_7 < 0) {
6235  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
6236  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 1;
6237  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_9 = 1;
6238  if (unlikely(__pyx_t_9 != -1)) {
6239  __Pyx_RaiseBufferIndexError(__pyx_t_9);
6240  __PYX_ERR(0, 213, __pyx_L1_error)
6241  }
6242  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
6243 
6244  /* "subsurfaceTransportFunctions.pyx":214
6245  * ebN = elementBoundariesArray[eN,ebN_local]
6246  * material_left = elementBoundaryTypes[ebN,0]
6247  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
6248  * for k in range(x.shape[2]):
6249  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left](x[eN,ebN_local,k],t)+
6250  */
6251  __pyx_t_7 = __pyx_v_ebN;
6252  __pyx_t_8 = 1;
6253  __pyx_t_9 = -1;
6254  if (__pyx_t_7 < 0) {
6255  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
6256  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
6257  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_9 = 0;
6258  if (__pyx_t_8 < 0) {
6259  __pyx_t_8 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
6260  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
6261  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_9 = 1;
6262  if (unlikely(__pyx_t_9 != -1)) {
6263  __Pyx_RaiseBufferIndexError(__pyx_t_9);
6264  __PYX_ERR(0, 214, __pyx_L1_error)
6265  }
6266  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
6267 
6268  /* "subsurfaceTransportFunctions.pyx":215
6269  * material_left = elementBoundaryTypes[ebN,0]
6270  * material_right= elementBoundaryTypes[ebN,1]
6271  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
6272  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left](x[eN,ebN_local,k],t)+
6273  * material_functions[material_right](x[eN,ebN_local,k],t))
6274  */
6275  __pyx_t_10 = (__pyx_v_x->dimensions[2]);
6276  __pyx_t_11 = __pyx_t_10;
6277  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_11; __pyx_t_9+=1) {
6278  __pyx_v_k = __pyx_t_9;
6279 
6280  /* "subsurfaceTransportFunctions.pyx":216
6281  * material_right= elementBoundaryTypes[ebN,1]
6282  * for k in range(x.shape[2]):
6283  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left](x[eN,ebN_local,k],t)+ # <<<<<<<<<<<<<<
6284  * material_functions[material_right](x[eN,ebN_local,k],t))
6285  *
6286  */
6287  if (unlikely(__pyx_v_material_functions == Py_None)) {
6288  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6289  __PYX_ERR(0, 216, __pyx_L1_error)
6290  }
6291  __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 216, __pyx_L1_error)
6292  __Pyx_GOTREF(__pyx_t_13);
6293  __pyx_t_14 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_13); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 216, __pyx_L1_error)
6294  __Pyx_GOTREF(__pyx_t_14);
6295  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
6296  __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 216, __pyx_L1_error)
6297  __Pyx_GOTREF(__pyx_t_13);
6298  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_ebN_local); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 216, __pyx_L1_error)
6299  __Pyx_GOTREF(__pyx_t_15);
6300  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 216, __pyx_L1_error)
6301  __Pyx_GOTREF(__pyx_t_16);
6302  __pyx_t_17 = PyTuple_New(3); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 216, __pyx_L1_error)
6303  __Pyx_GOTREF(__pyx_t_17);
6304  __Pyx_GIVEREF(__pyx_t_13);
6305  PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_13);
6306  __Pyx_GIVEREF(__pyx_t_15);
6307  PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_15);
6308  __Pyx_GIVEREF(__pyx_t_16);
6309  PyTuple_SET_ITEM(__pyx_t_17, 2, __pyx_t_16);
6310  __pyx_t_13 = 0;
6311  __pyx_t_15 = 0;
6312  __pyx_t_16 = 0;
6313  __pyx_t_16 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_17); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 216, __pyx_L1_error)
6314  __Pyx_GOTREF(__pyx_t_16);
6315  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
6316  __pyx_t_17 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 216, __pyx_L1_error)
6317  __Pyx_GOTREF(__pyx_t_17);
6318  __pyx_t_15 = NULL;
6319  __pyx_t_18 = 0;
6320  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
6321  __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_14);
6322  if (likely(__pyx_t_15)) {
6323  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
6324  __Pyx_INCREF(__pyx_t_15);
6325  __Pyx_INCREF(function);
6326  __Pyx_DECREF_SET(__pyx_t_14, function);
6327  __pyx_t_18 = 1;
6328  }
6329  }
6330  #if CYTHON_FAST_PYCALL
6331  if (PyFunction_Check(__pyx_t_14)) {
6332  PyObject *__pyx_temp[3] = {__pyx_t_15, __pyx_t_16, __pyx_t_17};
6333  __pyx_t_12 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_18, 2+__pyx_t_18); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 216, __pyx_L1_error)
6334  __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
6335  __Pyx_GOTREF(__pyx_t_12);
6336  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
6337  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
6338  } else
6339  #endif
6340  #if CYTHON_FAST_PYCCALL
6341  if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) {
6342  PyObject *__pyx_temp[3] = {__pyx_t_15, __pyx_t_16, __pyx_t_17};
6343  __pyx_t_12 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_18, 2+__pyx_t_18); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 216, __pyx_L1_error)
6344  __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
6345  __Pyx_GOTREF(__pyx_t_12);
6346  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
6347  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
6348  } else
6349  #endif
6350  {
6351  __pyx_t_13 = PyTuple_New(2+__pyx_t_18); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 216, __pyx_L1_error)
6352  __Pyx_GOTREF(__pyx_t_13);
6353  if (__pyx_t_15) {
6354  __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_15); __pyx_t_15 = NULL;
6355  }
6356  __Pyx_GIVEREF(__pyx_t_16);
6357  PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_18, __pyx_t_16);
6358  __Pyx_GIVEREF(__pyx_t_17);
6359  PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_18, __pyx_t_17);
6360  __pyx_t_16 = 0;
6361  __pyx_t_17 = 0;
6362  __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_13, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 216, __pyx_L1_error)
6363  __Pyx_GOTREF(__pyx_t_12);
6364  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
6365  }
6366  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
6367 
6368  /* "subsurfaceTransportFunctions.pyx":217
6369  * for k in range(x.shape[2]):
6370  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left](x[eN,ebN_local,k],t)+
6371  * material_functions[material_right](x[eN,ebN_local,k],t)) # <<<<<<<<<<<<<<
6372  *
6373  * def evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd,
6374  */
6375  if (unlikely(__pyx_v_material_functions == Py_None)) {
6376  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6377  __PYX_ERR(0, 217, __pyx_L1_error)
6378  }
6379  __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 217, __pyx_L1_error)
6380  __Pyx_GOTREF(__pyx_t_13);
6381  __pyx_t_17 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_13); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 217, __pyx_L1_error)
6382  __Pyx_GOTREF(__pyx_t_17);
6383  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
6384  __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 217, __pyx_L1_error)
6385  __Pyx_GOTREF(__pyx_t_13);
6386  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_ebN_local); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 217, __pyx_L1_error)
6387  __Pyx_GOTREF(__pyx_t_16);
6388  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 217, __pyx_L1_error)
6389  __Pyx_GOTREF(__pyx_t_15);
6390  __pyx_t_19 = PyTuple_New(3); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 217, __pyx_L1_error)
6391  __Pyx_GOTREF(__pyx_t_19);
6392  __Pyx_GIVEREF(__pyx_t_13);
6393  PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_13);
6394  __Pyx_GIVEREF(__pyx_t_16);
6395  PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_t_16);
6396  __Pyx_GIVEREF(__pyx_t_15);
6397  PyTuple_SET_ITEM(__pyx_t_19, 2, __pyx_t_15);
6398  __pyx_t_13 = 0;
6399  __pyx_t_16 = 0;
6400  __pyx_t_15 = 0;
6401  __pyx_t_15 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_19); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 217, __pyx_L1_error)
6402  __Pyx_GOTREF(__pyx_t_15);
6403  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
6404  __pyx_t_19 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 217, __pyx_L1_error)
6405  __Pyx_GOTREF(__pyx_t_19);
6406  __pyx_t_16 = NULL;
6407  __pyx_t_18 = 0;
6408  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_17))) {
6409  __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_17);
6410  if (likely(__pyx_t_16)) {
6411  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_17);
6412  __Pyx_INCREF(__pyx_t_16);
6413  __Pyx_INCREF(function);
6414  __Pyx_DECREF_SET(__pyx_t_17, function);
6415  __pyx_t_18 = 1;
6416  }
6417  }
6418  #if CYTHON_FAST_PYCALL
6419  if (PyFunction_Check(__pyx_t_17)) {
6420  PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_t_15, __pyx_t_19};
6421  __pyx_t_14 = __Pyx_PyFunction_FastCall(__pyx_t_17, __pyx_temp+1-__pyx_t_18, 2+__pyx_t_18); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 217, __pyx_L1_error)
6422  __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
6423  __Pyx_GOTREF(__pyx_t_14);
6424  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
6425  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
6426  } else
6427  #endif
6428  #if CYTHON_FAST_PYCCALL
6429  if (__Pyx_PyFastCFunction_Check(__pyx_t_17)) {
6430  PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_t_15, __pyx_t_19};
6431  __pyx_t_14 = __Pyx_PyCFunction_FastCall(__pyx_t_17, __pyx_temp+1-__pyx_t_18, 2+__pyx_t_18); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 217, __pyx_L1_error)
6432  __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
6433  __Pyx_GOTREF(__pyx_t_14);
6434  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
6435  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
6436  } else
6437  #endif
6438  {
6439  __pyx_t_13 = PyTuple_New(2+__pyx_t_18); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 217, __pyx_L1_error)
6440  __Pyx_GOTREF(__pyx_t_13);
6441  if (__pyx_t_16) {
6442  __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_16); __pyx_t_16 = NULL;
6443  }
6444  __Pyx_GIVEREF(__pyx_t_15);
6445  PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_18, __pyx_t_15);
6446  __Pyx_GIVEREF(__pyx_t_19);
6447  PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_18, __pyx_t_19);
6448  __pyx_t_15 = 0;
6449  __pyx_t_19 = 0;
6450  __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_17, __pyx_t_13, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 217, __pyx_L1_error)
6451  __Pyx_GOTREF(__pyx_t_14);
6452  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
6453  }
6454  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
6455 
6456  /* "subsurfaceTransportFunctions.pyx":216
6457  * material_right= elementBoundaryTypes[ebN,1]
6458  * for k in range(x.shape[2]):
6459  * ebq_vals[eN,ebN_local,k] = 0.5*(material_functions[material_left](x[eN,ebN_local,k],t)+ # <<<<<<<<<<<<<<
6460  * material_functions[material_right](x[eN,ebN_local,k],t))
6461  *
6462  */
6463  __pyx_t_17 = PyNumber_Add(__pyx_t_12, __pyx_t_14); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 216, __pyx_L1_error)
6464  __Pyx_GOTREF(__pyx_t_17);
6465  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
6466  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
6467  __pyx_t_14 = PyNumber_Multiply(__pyx_float_0_5, __pyx_t_17); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 216, __pyx_L1_error)
6468  __Pyx_GOTREF(__pyx_t_14);
6469  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
6470  __pyx_t_20 = __pyx_PyFloat_AsDouble(__pyx_t_14); if (unlikely((__pyx_t_20 == ((npy_double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 216, __pyx_L1_error)
6471  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
6472  __pyx_t_8 = __pyx_v_eN;
6473  __pyx_t_7 = __pyx_v_ebN_local;
6474  __pyx_t_21 = __pyx_v_k;
6475  __pyx_t_18 = -1;
6476  if (__pyx_t_8 < 0) {
6477  __pyx_t_8 += __pyx_pybuffernd_ebq_vals.diminfo[0].shape;
6478  if (unlikely(__pyx_t_8 < 0)) __pyx_t_18 = 0;
6479  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_ebq_vals.diminfo[0].shape)) __pyx_t_18 = 0;
6480  if (__pyx_t_7 < 0) {
6481  __pyx_t_7 += __pyx_pybuffernd_ebq_vals.diminfo[1].shape;
6482  if (unlikely(__pyx_t_7 < 0)) __pyx_t_18 = 1;
6483  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_ebq_vals.diminfo[1].shape)) __pyx_t_18 = 1;
6484  if (__pyx_t_21 < 0) {
6485  __pyx_t_21 += __pyx_pybuffernd_ebq_vals.diminfo[2].shape;
6486  if (unlikely(__pyx_t_21 < 0)) __pyx_t_18 = 2;
6487  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_ebq_vals.diminfo[2].shape)) __pyx_t_18 = 2;
6488  if (unlikely(__pyx_t_18 != -1)) {
6489  __Pyx_RaiseBufferIndexError(__pyx_t_18);
6490  __PYX_ERR(0, 216, __pyx_L1_error)
6491  }
6492  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_ebq_vals.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_ebq_vals.diminfo[1].strides, __pyx_t_21, __pyx_pybuffernd_ebq_vals.diminfo[2].strides) = __pyx_t_20;
6493  }
6494  }
6495  }
6496 
6497  /* "subsurfaceTransportFunctions.pyx":195
6498  *
6499  *
6500  * def evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
6501  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
6502  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
6503  */
6504 
6505  /* function exit code */
6506  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6507  goto __pyx_L0;
6508  __pyx_L1_error:;
6509  __Pyx_XDECREF(__pyx_t_12);
6510  __Pyx_XDECREF(__pyx_t_13);
6511  __Pyx_XDECREF(__pyx_t_14);
6512  __Pyx_XDECREF(__pyx_t_15);
6513  __Pyx_XDECREF(__pyx_t_16);
6514  __Pyx_XDECREF(__pyx_t_17);
6515  __Pyx_XDECREF(__pyx_t_19);
6516  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
6517  __Pyx_PyThreadState_declare
6518  __Pyx_PyThreadState_assign
6519  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
6520  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
6521  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
6522  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
6523  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
6524  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
6525  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
6526  __pyx_r = NULL;
6527  goto __pyx_L2;
6528  __pyx_L0:;
6529  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
6530  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
6531  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
6532  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
6533  __pyx_L2:;
6534  __Pyx_XGIVEREF(__pyx_r);
6535  __Pyx_RefNannyFinishContext();
6536  return __pyx_r;
6537 }
6538 
6539 /* "subsurfaceTransportFunctions.pyx":219
6540  * material_functions[material_right](x[eN,ebN_local,k],t))
6541  *
6542  * def evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
6543  * double t,
6544  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
6545  */
6546 
6547 /* Python wrapper */
6548 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_23evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
6549 static char __pyx_doc_28subsurfaceTransportFunctions_22evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage[] = "\n loop over quadrature array and evaluate function \ten f_{mn}(x,t) = f^L_{j,mn}(x,t)f^R_{k,mn}(x,t)/(f^L_{j,mn}(x,t)+f^R_{k,mn})\n assuming element on left is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
6550 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_23evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage = {"evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_23evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_22evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage};
6551 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_23evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6552  int __pyx_v_nd;
6553  double __pyx_v_t;
6554  PyArrayObject *__pyx_v_elementBoundariesArray = 0;
6555  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
6556  PyArrayObject *__pyx_v_x = 0;
6557  PyArrayObject *__pyx_v_ebq_vals = 0;
6558  PyObject *__pyx_v_material_functions = 0;
6559  int __pyx_lineno = 0;
6560  const char *__pyx_filename = NULL;
6561  int __pyx_clineno = 0;
6562  PyObject *__pyx_r = 0;
6563  __Pyx_RefNannyDeclarations
6564  __Pyx_RefNannySetupContext("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage (wrapper)", 0);
6565  {
6566  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nd,&__pyx_n_s_t,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_x,&__pyx_n_s_ebq_vals,&__pyx_n_s_material_functions,0};
6567  PyObject* values[7] = {0,0,0,0,0,0,0};
6568  if (unlikely(__pyx_kwds)) {
6569  Py_ssize_t kw_args;
6570  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6571  switch (pos_args) {
6572  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
6573  CYTHON_FALLTHROUGH;
6574  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
6575  CYTHON_FALLTHROUGH;
6576  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6577  CYTHON_FALLTHROUGH;
6578  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6579  CYTHON_FALLTHROUGH;
6580  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6581  CYTHON_FALLTHROUGH;
6582  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6583  CYTHON_FALLTHROUGH;
6584  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6585  CYTHON_FALLTHROUGH;
6586  case 0: break;
6587  default: goto __pyx_L5_argtuple_error;
6588  }
6589  kw_args = PyDict_Size(__pyx_kwds);
6590  switch (pos_args) {
6591  case 0:
6592  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nd)) != 0)) kw_args--;
6593  else goto __pyx_L5_argtuple_error;
6594  CYTHON_FALLTHROUGH;
6595  case 1:
6596  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
6597  else {
6598  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 7, 7, 1); __PYX_ERR(0, 219, __pyx_L3_error)
6599  }
6600  CYTHON_FALLTHROUGH;
6601  case 2:
6602  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
6603  else {
6604  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 7, 7, 2); __PYX_ERR(0, 219, __pyx_L3_error)
6605  }
6606  CYTHON_FALLTHROUGH;
6607  case 3:
6608  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
6609  else {
6610  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 7, 7, 3); __PYX_ERR(0, 219, __pyx_L3_error)
6611  }
6612  CYTHON_FALLTHROUGH;
6613  case 4:
6614  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
6615  else {
6616  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 7, 7, 4); __PYX_ERR(0, 219, __pyx_L3_error)
6617  }
6618  CYTHON_FALLTHROUGH;
6619  case 5:
6620  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ebq_vals)) != 0)) kw_args--;
6621  else {
6622  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 7, 7, 5); __PYX_ERR(0, 219, __pyx_L3_error)
6623  }
6624  CYTHON_FALLTHROUGH;
6625  case 6:
6626  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
6627  else {
6628  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 7, 7, 6); __PYX_ERR(0, 219, __pyx_L3_error)
6629  }
6630  }
6631  if (unlikely(kw_args > 0)) {
6632  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage") < 0)) __PYX_ERR(0, 219, __pyx_L3_error)
6633  }
6634  } else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
6635  goto __pyx_L5_argtuple_error;
6636  } else {
6637  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6638  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6639  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6640  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6641  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6642  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
6643  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
6644  }
6645  __pyx_v_nd = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_nd == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 219, __pyx_L3_error)
6646  __pyx_v_t = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 220, __pyx_L3_error)
6647  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[2]);
6648  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[3]);
6649  __pyx_v_x = ((PyArrayObject *)values[4]);
6650  __pyx_v_ebq_vals = ((PyArrayObject *)values[5]);
6651  __pyx_v_material_functions = ((PyObject*)values[6]);
6652  }
6653  goto __pyx_L4_argument_unpacking_done;
6654  __pyx_L5_argtuple_error:;
6655  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 219, __pyx_L3_error)
6656  __pyx_L3_error:;
6657  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
6658  __Pyx_RefNannyFinishContext();
6659  return NULL;
6660  __pyx_L4_argument_unpacking_done:;
6661  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) __PYX_ERR(0, 221, __pyx_L1_error)
6662  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) __PYX_ERR(0, 222, __pyx_L1_error)
6663  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 223, __pyx_L1_error)
6664  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_vals", 0))) __PYX_ERR(0, 224, __pyx_L1_error)
6665  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 225, __pyx_L1_error)
6666  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_22evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(__pyx_self, __pyx_v_nd, __pyx_v_t, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_x, __pyx_v_ebq_vals, __pyx_v_material_functions);
6667 
6668  /* function exit code */
6669  goto __pyx_L0;
6670  __pyx_L1_error:;
6671  __pyx_r = NULL;
6672  __pyx_L0:;
6673  __Pyx_RefNannyFinishContext();
6674  return __pyx_r;
6675 }
6676 
6677 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_22evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, double __pyx_v_t, PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_vals, PyObject *__pyx_v_material_functions) {
6678  int __pyx_v_eN;
6679  int __pyx_v_ebN;
6680  int __pyx_v_ebN_local;
6681  int __pyx_v_k;
6682  int __pyx_v_material_left;
6683  int __pyx_v_material_right;
6684  int __pyx_v_I;
6685  int __pyx_v_J;
6686  double __pyx_v_numer;
6687  double __pyx_v_denom;
6688  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_vals;
6689  __Pyx_Buffer __pyx_pybuffer_ebq_vals;
6690  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
6691  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
6692  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
6693  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
6694  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
6695  __Pyx_Buffer __pyx_pybuffer_x;
6696  PyObject *__pyx_r = NULL;
6697  __Pyx_RefNannyDeclarations
6698  npy_intp __pyx_t_1;
6699  npy_intp __pyx_t_2;
6700  int __pyx_t_3;
6701  npy_intp __pyx_t_4;
6702  npy_intp __pyx_t_5;
6703  int __pyx_t_6;
6704  Py_ssize_t __pyx_t_7;
6705  Py_ssize_t __pyx_t_8;
6706  int __pyx_t_9;
6707  npy_intp __pyx_t_10;
6708  npy_intp __pyx_t_11;
6709  int __pyx_t_12;
6710  int __pyx_t_13;
6711  int __pyx_t_14;
6712  int __pyx_t_15;
6713  int __pyx_t_16;
6714  int __pyx_t_17;
6715  PyObject *__pyx_t_18 = NULL;
6716  PyObject *__pyx_t_19 = NULL;
6717  PyObject *__pyx_t_20 = NULL;
6718  PyObject *__pyx_t_21 = NULL;
6719  PyObject *__pyx_t_22 = NULL;
6720  PyObject *__pyx_t_23 = NULL;
6721  int __pyx_t_24;
6722  PyObject *__pyx_t_25 = NULL;
6723  double __pyx_t_26;
6724  Py_ssize_t __pyx_t_27;
6725  Py_ssize_t __pyx_t_28;
6726  int __pyx_lineno = 0;
6727  const char *__pyx_filename = NULL;
6728  int __pyx_clineno = 0;
6729  __Pyx_RefNannySetupContext("evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", 0);
6730  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
6731  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
6732  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
6733  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
6734  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
6735  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
6736  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
6737  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
6738  __pyx_pybuffer_x.pybuffer.buf = NULL;
6739  __pyx_pybuffer_x.refcount = 0;
6740  __pyx_pybuffernd_x.data = NULL;
6741  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
6742  __pyx_pybuffer_ebq_vals.pybuffer.buf = NULL;
6743  __pyx_pybuffer_ebq_vals.refcount = 0;
6744  __pyx_pybuffernd_ebq_vals.data = NULL;
6745  __pyx_pybuffernd_ebq_vals.rcbuffer = &__pyx_pybuffer_ebq_vals;
6746  {
6747  __Pyx_BufFmt_StackElem __pyx_stack[1];
6748  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 219, __pyx_L1_error)
6749  }
6750  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
6751  {
6752  __Pyx_BufFmt_StackElem __pyx_stack[1];
6753  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 219, __pyx_L1_error)
6754  }
6755  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
6756  {
6757  __Pyx_BufFmt_StackElem __pyx_stack[1];
6758  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 219, __pyx_L1_error)
6759  }
6760  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_x.diminfo[3].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_x.diminfo[3].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[3];
6761  {
6762  __Pyx_BufFmt_StackElem __pyx_stack[1];
6763  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 219, __pyx_L1_error)
6764  }
6765  __pyx_pybuffernd_ebq_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_ebq_vals.diminfo[2].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_ebq_vals.diminfo[2].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_ebq_vals.diminfo[3].strides = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_ebq_vals.diminfo[3].shape = __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.shape[3];
6766 
6767  /* "subsurfaceTransportFunctions.pyx":236
6768  * cdef double numer,denom
6769  *
6770  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
6771  * for ebN_local in range(x.shape[1]):
6772  * ebN = elementBoundariesArray[eN,ebN_local]
6773  */
6774  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
6775  __pyx_t_2 = __pyx_t_1;
6776  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
6777  __pyx_v_eN = __pyx_t_3;
6778 
6779  /* "subsurfaceTransportFunctions.pyx":237
6780  *
6781  * for eN in range(x.shape[0]):
6782  * for ebN_local in range(x.shape[1]): # <<<<<<<<<<<<<<
6783  * ebN = elementBoundariesArray[eN,ebN_local]
6784  * material_left = elementBoundaryTypes[ebN,0]
6785  */
6786  __pyx_t_4 = (__pyx_v_x->dimensions[1]);
6787  __pyx_t_5 = __pyx_t_4;
6788  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
6789  __pyx_v_ebN_local = __pyx_t_6;
6790 
6791  /* "subsurfaceTransportFunctions.pyx":238
6792  * for eN in range(x.shape[0]):
6793  * for ebN_local in range(x.shape[1]):
6794  * ebN = elementBoundariesArray[eN,ebN_local] # <<<<<<<<<<<<<<
6795  * material_left = elementBoundaryTypes[ebN,0]
6796  * material_right= elementBoundaryTypes[ebN,1]
6797  */
6798  __pyx_t_7 = __pyx_v_eN;
6799  __pyx_t_8 = __pyx_v_ebN_local;
6800  __pyx_t_9 = -1;
6801  if (__pyx_t_7 < 0) {
6802  __pyx_t_7 += __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape;
6803  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
6804  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape)) __pyx_t_9 = 0;
6805  if (__pyx_t_8 < 0) {
6806  __pyx_t_8 += __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape;
6807  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
6808  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape)) __pyx_t_9 = 1;
6809  if (unlikely(__pyx_t_9 != -1)) {
6810  __Pyx_RaiseBufferIndexError(__pyx_t_9);
6811  __PYX_ERR(0, 238, __pyx_L1_error)
6812  }
6813  __pyx_v_ebN = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides));
6814 
6815  /* "subsurfaceTransportFunctions.pyx":239
6816  * for ebN_local in range(x.shape[1]):
6817  * ebN = elementBoundariesArray[eN,ebN_local]
6818  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
6819  * material_right= elementBoundaryTypes[ebN,1]
6820  * for k in range(x.shape[2]):
6821  */
6822  __pyx_t_8 = __pyx_v_ebN;
6823  __pyx_t_7 = 0;
6824  __pyx_t_9 = -1;
6825  if (__pyx_t_8 < 0) {
6826  __pyx_t_8 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
6827  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0;
6828  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_9 = 0;
6829  if (__pyx_t_7 < 0) {
6830  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
6831  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 1;
6832  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_9 = 1;
6833  if (unlikely(__pyx_t_9 != -1)) {
6834  __Pyx_RaiseBufferIndexError(__pyx_t_9);
6835  __PYX_ERR(0, 239, __pyx_L1_error)
6836  }
6837  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
6838 
6839  /* "subsurfaceTransportFunctions.pyx":240
6840  * ebN = elementBoundariesArray[eN,ebN_local]
6841  * material_left = elementBoundaryTypes[ebN,0]
6842  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
6843  * for k in range(x.shape[2]):
6844  * for I in range(nd):
6845  */
6846  __pyx_t_7 = __pyx_v_ebN;
6847  __pyx_t_8 = 1;
6848  __pyx_t_9 = -1;
6849  if (__pyx_t_7 < 0) {
6850  __pyx_t_7 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
6851  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
6852  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_9 = 0;
6853  if (__pyx_t_8 < 0) {
6854  __pyx_t_8 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
6855  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
6856  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_9 = 1;
6857  if (unlikely(__pyx_t_9 != -1)) {
6858  __Pyx_RaiseBufferIndexError(__pyx_t_9);
6859  __PYX_ERR(0, 240, __pyx_L1_error)
6860  }
6861  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
6862 
6863  /* "subsurfaceTransportFunctions.pyx":241
6864  * material_left = elementBoundaryTypes[ebN,0]
6865  * material_right= elementBoundaryTypes[ebN,1]
6866  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
6867  * for I in range(nd):
6868  * for J in range(nd):
6869  */
6870  __pyx_t_10 = (__pyx_v_x->dimensions[2]);
6871  __pyx_t_11 = __pyx_t_10;
6872  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_11; __pyx_t_9+=1) {
6873  __pyx_v_k = __pyx_t_9;
6874 
6875  /* "subsurfaceTransportFunctions.pyx":242
6876  * material_right= elementBoundaryTypes[ebN,1]
6877  * for k in range(x.shape[2]):
6878  * for I in range(nd): # <<<<<<<<<<<<<<
6879  * for J in range(nd):
6880  * numer = 2.0*material_functions[material_left](x[eN,ebN_local,k],t)[I,J]*material_functions[material_right](x[eN,ebN_local,k],t)[I,J]
6881  */
6882  __pyx_t_12 = __pyx_v_nd;
6883  __pyx_t_13 = __pyx_t_12;
6884  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
6885  __pyx_v_I = __pyx_t_14;
6886 
6887  /* "subsurfaceTransportFunctions.pyx":243
6888  * for k in range(x.shape[2]):
6889  * for I in range(nd):
6890  * for J in range(nd): # <<<<<<<<<<<<<<
6891  * numer = 2.0*material_functions[material_left](x[eN,ebN_local,k],t)[I,J]*material_functions[material_right](x[eN,ebN_local,k],t)[I,J]
6892  * denom = material_functions[material_left](x[eN,ebN_local,k],t)[I,J] + material_functions[material_right](x[eN,ebN_local,k],t)[I,J] + 1.0e-20
6893  */
6894  __pyx_t_15 = __pyx_v_nd;
6895  __pyx_t_16 = __pyx_t_15;
6896  for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) {
6897  __pyx_v_J = __pyx_t_17;
6898 
6899  /* "subsurfaceTransportFunctions.pyx":244
6900  * for I in range(nd):
6901  * for J in range(nd):
6902  * numer = 2.0*material_functions[material_left](x[eN,ebN_local,k],t)[I,J]*material_functions[material_right](x[eN,ebN_local,k],t)[I,J] # <<<<<<<<<<<<<<
6903  * denom = material_functions[material_left](x[eN,ebN_local,k],t)[I,J] + material_functions[material_right](x[eN,ebN_local,k],t)[I,J] + 1.0e-20
6904  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
6905  */
6906  if (unlikely(__pyx_v_material_functions == Py_None)) {
6907  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
6908  __PYX_ERR(0, 244, __pyx_L1_error)
6909  }
6910  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 244, __pyx_L1_error)
6911  __Pyx_GOTREF(__pyx_t_19);
6912  __pyx_t_20 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_19); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 244, __pyx_L1_error)
6913  __Pyx_GOTREF(__pyx_t_20);
6914  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
6915  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 244, __pyx_L1_error)
6916  __Pyx_GOTREF(__pyx_t_19);
6917  __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_ebN_local); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 244, __pyx_L1_error)
6918  __Pyx_GOTREF(__pyx_t_21);
6919  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 244, __pyx_L1_error)
6920  __Pyx_GOTREF(__pyx_t_22);
6921  __pyx_t_23 = PyTuple_New(3); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 244, __pyx_L1_error)
6922  __Pyx_GOTREF(__pyx_t_23);
6923  __Pyx_GIVEREF(__pyx_t_19);
6924  PyTuple_SET_ITEM(__pyx_t_23, 0, __pyx_t_19);
6925  __Pyx_GIVEREF(__pyx_t_21);
6926  PyTuple_SET_ITEM(__pyx_t_23, 1, __pyx_t_21);
6927  __Pyx_GIVEREF(__pyx_t_22);
6928  PyTuple_SET_ITEM(__pyx_t_23, 2, __pyx_t_22);
6929  __pyx_t_19 = 0;
6930  __pyx_t_21 = 0;
6931  __pyx_t_22 = 0;
6932  __pyx_t_22 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_23); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 244, __pyx_L1_error)
6933  __Pyx_GOTREF(__pyx_t_22);
6934  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
6935  __pyx_t_23 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 244, __pyx_L1_error)
6936  __Pyx_GOTREF(__pyx_t_23);
6937  __pyx_t_21 = NULL;
6938  __pyx_t_24 = 0;
6939  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_20))) {
6940  __pyx_t_21 = PyMethod_GET_SELF(__pyx_t_20);
6941  if (likely(__pyx_t_21)) {
6942  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_20);
6943  __Pyx_INCREF(__pyx_t_21);
6944  __Pyx_INCREF(function);
6945  __Pyx_DECREF_SET(__pyx_t_20, function);
6946  __pyx_t_24 = 1;
6947  }
6948  }
6949  #if CYTHON_FAST_PYCALL
6950  if (PyFunction_Check(__pyx_t_20)) {
6951  PyObject *__pyx_temp[3] = {__pyx_t_21, __pyx_t_22, __pyx_t_23};
6952  __pyx_t_18 = __Pyx_PyFunction_FastCall(__pyx_t_20, __pyx_temp+1-__pyx_t_24, 2+__pyx_t_24); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 244, __pyx_L1_error)
6953  __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
6954  __Pyx_GOTREF(__pyx_t_18);
6955  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
6956  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
6957  } else
6958  #endif
6959  #if CYTHON_FAST_PYCCALL
6960  if (__Pyx_PyFastCFunction_Check(__pyx_t_20)) {
6961  PyObject *__pyx_temp[3] = {__pyx_t_21, __pyx_t_22, __pyx_t_23};
6962  __pyx_t_18 = __Pyx_PyCFunction_FastCall(__pyx_t_20, __pyx_temp+1-__pyx_t_24, 2+__pyx_t_24); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 244, __pyx_L1_error)
6963  __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
6964  __Pyx_GOTREF(__pyx_t_18);
6965  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
6966  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
6967  } else
6968  #endif
6969  {
6970  __pyx_t_19 = PyTuple_New(2+__pyx_t_24); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 244, __pyx_L1_error)
6971  __Pyx_GOTREF(__pyx_t_19);
6972  if (__pyx_t_21) {
6973  __Pyx_GIVEREF(__pyx_t_21); PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_21); __pyx_t_21 = NULL;
6974  }
6975  __Pyx_GIVEREF(__pyx_t_22);
6976  PyTuple_SET_ITEM(__pyx_t_19, 0+__pyx_t_24, __pyx_t_22);
6977  __Pyx_GIVEREF(__pyx_t_23);
6978  PyTuple_SET_ITEM(__pyx_t_19, 1+__pyx_t_24, __pyx_t_23);
6979  __pyx_t_22 = 0;
6980  __pyx_t_23 = 0;
6981  __pyx_t_18 = __Pyx_PyObject_Call(__pyx_t_20, __pyx_t_19, NULL); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 244, __pyx_L1_error)
6982  __Pyx_GOTREF(__pyx_t_18);
6983  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
6984  }
6985  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
6986  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 244, __pyx_L1_error)
6987  __Pyx_GOTREF(__pyx_t_20);
6988  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 244, __pyx_L1_error)
6989  __Pyx_GOTREF(__pyx_t_19);
6990  __pyx_t_23 = PyTuple_New(2); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 244, __pyx_L1_error)
6991  __Pyx_GOTREF(__pyx_t_23);
6992  __Pyx_GIVEREF(__pyx_t_20);
6993  PyTuple_SET_ITEM(__pyx_t_23, 0, __pyx_t_20);
6994  __Pyx_GIVEREF(__pyx_t_19);
6995  PyTuple_SET_ITEM(__pyx_t_23, 1, __pyx_t_19);
6996  __pyx_t_20 = 0;
6997  __pyx_t_19 = 0;
6998  __pyx_t_19 = __Pyx_PyObject_GetItem(__pyx_t_18, __pyx_t_23); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 244, __pyx_L1_error)
6999  __Pyx_GOTREF(__pyx_t_19);
7000  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
7001  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
7002  __pyx_t_23 = PyNumber_Multiply(__pyx_float_2_0, __pyx_t_19); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 244, __pyx_L1_error)
7003  __Pyx_GOTREF(__pyx_t_23);
7004  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
7005  if (unlikely(__pyx_v_material_functions == Py_None)) {
7006  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
7007  __PYX_ERR(0, 244, __pyx_L1_error)
7008  }
7009  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 244, __pyx_L1_error)
7010  __Pyx_GOTREF(__pyx_t_18);
7011  __pyx_t_20 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_18); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 244, __pyx_L1_error)
7012  __Pyx_GOTREF(__pyx_t_20);
7013  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
7014  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 244, __pyx_L1_error)
7015  __Pyx_GOTREF(__pyx_t_18);
7016  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_ebN_local); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 244, __pyx_L1_error)
7017  __Pyx_GOTREF(__pyx_t_22);
7018  __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 244, __pyx_L1_error)
7019  __Pyx_GOTREF(__pyx_t_21);
7020  __pyx_t_25 = PyTuple_New(3); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 244, __pyx_L1_error)
7021  __Pyx_GOTREF(__pyx_t_25);
7022  __Pyx_GIVEREF(__pyx_t_18);
7023  PyTuple_SET_ITEM(__pyx_t_25, 0, __pyx_t_18);
7024  __Pyx_GIVEREF(__pyx_t_22);
7025  PyTuple_SET_ITEM(__pyx_t_25, 1, __pyx_t_22);
7026  __Pyx_GIVEREF(__pyx_t_21);
7027  PyTuple_SET_ITEM(__pyx_t_25, 2, __pyx_t_21);
7028  __pyx_t_18 = 0;
7029  __pyx_t_22 = 0;
7030  __pyx_t_21 = 0;
7031  __pyx_t_21 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_25); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 244, __pyx_L1_error)
7032  __Pyx_GOTREF(__pyx_t_21);
7033  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
7034  __pyx_t_25 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 244, __pyx_L1_error)
7035  __Pyx_GOTREF(__pyx_t_25);
7036  __pyx_t_22 = NULL;
7037  __pyx_t_24 = 0;
7038  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_20))) {
7039  __pyx_t_22 = PyMethod_GET_SELF(__pyx_t_20);
7040  if (likely(__pyx_t_22)) {
7041  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_20);
7042  __Pyx_INCREF(__pyx_t_22);
7043  __Pyx_INCREF(function);
7044  __Pyx_DECREF_SET(__pyx_t_20, function);
7045  __pyx_t_24 = 1;
7046  }
7047  }
7048  #if CYTHON_FAST_PYCALL
7049  if (PyFunction_Check(__pyx_t_20)) {
7050  PyObject *__pyx_temp[3] = {__pyx_t_22, __pyx_t_21, __pyx_t_25};
7051  __pyx_t_19 = __Pyx_PyFunction_FastCall(__pyx_t_20, __pyx_temp+1-__pyx_t_24, 2+__pyx_t_24); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 244, __pyx_L1_error)
7052  __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
7053  __Pyx_GOTREF(__pyx_t_19);
7054  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
7055  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
7056  } else
7057  #endif
7058  #if CYTHON_FAST_PYCCALL
7059  if (__Pyx_PyFastCFunction_Check(__pyx_t_20)) {
7060  PyObject *__pyx_temp[3] = {__pyx_t_22, __pyx_t_21, __pyx_t_25};
7061  __pyx_t_19 = __Pyx_PyCFunction_FastCall(__pyx_t_20, __pyx_temp+1-__pyx_t_24, 2+__pyx_t_24); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 244, __pyx_L1_error)
7062  __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
7063  __Pyx_GOTREF(__pyx_t_19);
7064  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
7065  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
7066  } else
7067  #endif
7068  {
7069  __pyx_t_18 = PyTuple_New(2+__pyx_t_24); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 244, __pyx_L1_error)
7070  __Pyx_GOTREF(__pyx_t_18);
7071  if (__pyx_t_22) {
7072  __Pyx_GIVEREF(__pyx_t_22); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_22); __pyx_t_22 = NULL;
7073  }
7074  __Pyx_GIVEREF(__pyx_t_21);
7075  PyTuple_SET_ITEM(__pyx_t_18, 0+__pyx_t_24, __pyx_t_21);
7076  __Pyx_GIVEREF(__pyx_t_25);
7077  PyTuple_SET_ITEM(__pyx_t_18, 1+__pyx_t_24, __pyx_t_25);
7078  __pyx_t_21 = 0;
7079  __pyx_t_25 = 0;
7080  __pyx_t_19 = __Pyx_PyObject_Call(__pyx_t_20, __pyx_t_18, NULL); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 244, __pyx_L1_error)
7081  __Pyx_GOTREF(__pyx_t_19);
7082  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
7083  }
7084  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
7085  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 244, __pyx_L1_error)
7086  __Pyx_GOTREF(__pyx_t_20);
7087  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 244, __pyx_L1_error)
7088  __Pyx_GOTREF(__pyx_t_18);
7089  __pyx_t_25 = PyTuple_New(2); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 244, __pyx_L1_error)
7090  __Pyx_GOTREF(__pyx_t_25);
7091  __Pyx_GIVEREF(__pyx_t_20);
7092  PyTuple_SET_ITEM(__pyx_t_25, 0, __pyx_t_20);
7093  __Pyx_GIVEREF(__pyx_t_18);
7094  PyTuple_SET_ITEM(__pyx_t_25, 1, __pyx_t_18);
7095  __pyx_t_20 = 0;
7096  __pyx_t_18 = 0;
7097  __pyx_t_18 = __Pyx_PyObject_GetItem(__pyx_t_19, __pyx_t_25); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 244, __pyx_L1_error)
7098  __Pyx_GOTREF(__pyx_t_18);
7099  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
7100  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
7101  __pyx_t_25 = PyNumber_Multiply(__pyx_t_23, __pyx_t_18); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 244, __pyx_L1_error)
7102  __Pyx_GOTREF(__pyx_t_25);
7103  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
7104  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
7105  __pyx_t_26 = __pyx_PyFloat_AsDouble(__pyx_t_25); if (unlikely((__pyx_t_26 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 244, __pyx_L1_error)
7106  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
7107  __pyx_v_numer = __pyx_t_26;
7108 
7109  /* "subsurfaceTransportFunctions.pyx":245
7110  * for J in range(nd):
7111  * numer = 2.0*material_functions[material_left](x[eN,ebN_local,k],t)[I,J]*material_functions[material_right](x[eN,ebN_local,k],t)[I,J]
7112  * denom = material_functions[material_left](x[eN,ebN_local,k],t)[I,J] + material_functions[material_right](x[eN,ebN_local,k],t)[I,J] + 1.0e-20 # <<<<<<<<<<<<<<
7113  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
7114  *
7115  */
7116  if (unlikely(__pyx_v_material_functions == Py_None)) {
7117  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
7118  __PYX_ERR(0, 245, __pyx_L1_error)
7119  }
7120  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 245, __pyx_L1_error)
7121  __Pyx_GOTREF(__pyx_t_18);
7122  __pyx_t_23 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_18); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 245, __pyx_L1_error)
7123  __Pyx_GOTREF(__pyx_t_23);
7124  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
7125  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 245, __pyx_L1_error)
7126  __Pyx_GOTREF(__pyx_t_18);
7127  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_ebN_local); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 245, __pyx_L1_error)
7128  __Pyx_GOTREF(__pyx_t_19);
7129  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 245, __pyx_L1_error)
7130  __Pyx_GOTREF(__pyx_t_20);
7131  __pyx_t_21 = PyTuple_New(3); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 245, __pyx_L1_error)
7132  __Pyx_GOTREF(__pyx_t_21);
7133  __Pyx_GIVEREF(__pyx_t_18);
7134  PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_18);
7135  __Pyx_GIVEREF(__pyx_t_19);
7136  PyTuple_SET_ITEM(__pyx_t_21, 1, __pyx_t_19);
7137  __Pyx_GIVEREF(__pyx_t_20);
7138  PyTuple_SET_ITEM(__pyx_t_21, 2, __pyx_t_20);
7139  __pyx_t_18 = 0;
7140  __pyx_t_19 = 0;
7141  __pyx_t_20 = 0;
7142  __pyx_t_20 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_21); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 245, __pyx_L1_error)
7143  __Pyx_GOTREF(__pyx_t_20);
7144  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
7145  __pyx_t_21 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 245, __pyx_L1_error)
7146  __Pyx_GOTREF(__pyx_t_21);
7147  __pyx_t_19 = NULL;
7148  __pyx_t_24 = 0;
7149  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_23))) {
7150  __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_23);
7151  if (likely(__pyx_t_19)) {
7152  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_23);
7153  __Pyx_INCREF(__pyx_t_19);
7154  __Pyx_INCREF(function);
7155  __Pyx_DECREF_SET(__pyx_t_23, function);
7156  __pyx_t_24 = 1;
7157  }
7158  }
7159  #if CYTHON_FAST_PYCALL
7160  if (PyFunction_Check(__pyx_t_23)) {
7161  PyObject *__pyx_temp[3] = {__pyx_t_19, __pyx_t_20, __pyx_t_21};
7162  __pyx_t_25 = __Pyx_PyFunction_FastCall(__pyx_t_23, __pyx_temp+1-__pyx_t_24, 2+__pyx_t_24); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 245, __pyx_L1_error)
7163  __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
7164  __Pyx_GOTREF(__pyx_t_25);
7165  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
7166  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
7167  } else
7168  #endif
7169  #if CYTHON_FAST_PYCCALL
7170  if (__Pyx_PyFastCFunction_Check(__pyx_t_23)) {
7171  PyObject *__pyx_temp[3] = {__pyx_t_19, __pyx_t_20, __pyx_t_21};
7172  __pyx_t_25 = __Pyx_PyCFunction_FastCall(__pyx_t_23, __pyx_temp+1-__pyx_t_24, 2+__pyx_t_24); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 245, __pyx_L1_error)
7173  __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
7174  __Pyx_GOTREF(__pyx_t_25);
7175  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
7176  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
7177  } else
7178  #endif
7179  {
7180  __pyx_t_18 = PyTuple_New(2+__pyx_t_24); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 245, __pyx_L1_error)
7181  __Pyx_GOTREF(__pyx_t_18);
7182  if (__pyx_t_19) {
7183  __Pyx_GIVEREF(__pyx_t_19); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_19); __pyx_t_19 = NULL;
7184  }
7185  __Pyx_GIVEREF(__pyx_t_20);
7186  PyTuple_SET_ITEM(__pyx_t_18, 0+__pyx_t_24, __pyx_t_20);
7187  __Pyx_GIVEREF(__pyx_t_21);
7188  PyTuple_SET_ITEM(__pyx_t_18, 1+__pyx_t_24, __pyx_t_21);
7189  __pyx_t_20 = 0;
7190  __pyx_t_21 = 0;
7191  __pyx_t_25 = __Pyx_PyObject_Call(__pyx_t_23, __pyx_t_18, NULL); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 245, __pyx_L1_error)
7192  __Pyx_GOTREF(__pyx_t_25);
7193  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
7194  }
7195  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
7196  __pyx_t_23 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 245, __pyx_L1_error)
7197  __Pyx_GOTREF(__pyx_t_23);
7198  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 245, __pyx_L1_error)
7199  __Pyx_GOTREF(__pyx_t_18);
7200  __pyx_t_21 = PyTuple_New(2); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 245, __pyx_L1_error)
7201  __Pyx_GOTREF(__pyx_t_21);
7202  __Pyx_GIVEREF(__pyx_t_23);
7203  PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_23);
7204  __Pyx_GIVEREF(__pyx_t_18);
7205  PyTuple_SET_ITEM(__pyx_t_21, 1, __pyx_t_18);
7206  __pyx_t_23 = 0;
7207  __pyx_t_18 = 0;
7208  __pyx_t_18 = __Pyx_PyObject_GetItem(__pyx_t_25, __pyx_t_21); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 245, __pyx_L1_error)
7209  __Pyx_GOTREF(__pyx_t_18);
7210  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
7211  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
7212  if (unlikely(__pyx_v_material_functions == Py_None)) {
7213  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
7214  __PYX_ERR(0, 245, __pyx_L1_error)
7215  }
7216  __pyx_t_25 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 245, __pyx_L1_error)
7217  __Pyx_GOTREF(__pyx_t_25);
7218  __pyx_t_23 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_25); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 245, __pyx_L1_error)
7219  __Pyx_GOTREF(__pyx_t_23);
7220  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
7221  __pyx_t_25 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 245, __pyx_L1_error)
7222  __Pyx_GOTREF(__pyx_t_25);
7223  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_ebN_local); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 245, __pyx_L1_error)
7224  __Pyx_GOTREF(__pyx_t_20);
7225  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 245, __pyx_L1_error)
7226  __Pyx_GOTREF(__pyx_t_19);
7227  __pyx_t_22 = PyTuple_New(3); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 245, __pyx_L1_error)
7228  __Pyx_GOTREF(__pyx_t_22);
7229  __Pyx_GIVEREF(__pyx_t_25);
7230  PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_25);
7231  __Pyx_GIVEREF(__pyx_t_20);
7232  PyTuple_SET_ITEM(__pyx_t_22, 1, __pyx_t_20);
7233  __Pyx_GIVEREF(__pyx_t_19);
7234  PyTuple_SET_ITEM(__pyx_t_22, 2, __pyx_t_19);
7235  __pyx_t_25 = 0;
7236  __pyx_t_20 = 0;
7237  __pyx_t_19 = 0;
7238  __pyx_t_19 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_22); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 245, __pyx_L1_error)
7239  __Pyx_GOTREF(__pyx_t_19);
7240  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
7241  __pyx_t_22 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 245, __pyx_L1_error)
7242  __Pyx_GOTREF(__pyx_t_22);
7243  __pyx_t_20 = NULL;
7244  __pyx_t_24 = 0;
7245  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_23))) {
7246  __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_23);
7247  if (likely(__pyx_t_20)) {
7248  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_23);
7249  __Pyx_INCREF(__pyx_t_20);
7250  __Pyx_INCREF(function);
7251  __Pyx_DECREF_SET(__pyx_t_23, function);
7252  __pyx_t_24 = 1;
7253  }
7254  }
7255  #if CYTHON_FAST_PYCALL
7256  if (PyFunction_Check(__pyx_t_23)) {
7257  PyObject *__pyx_temp[3] = {__pyx_t_20, __pyx_t_19, __pyx_t_22};
7258  __pyx_t_21 = __Pyx_PyFunction_FastCall(__pyx_t_23, __pyx_temp+1-__pyx_t_24, 2+__pyx_t_24); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 245, __pyx_L1_error)
7259  __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
7260  __Pyx_GOTREF(__pyx_t_21);
7261  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
7262  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
7263  } else
7264  #endif
7265  #if CYTHON_FAST_PYCCALL
7266  if (__Pyx_PyFastCFunction_Check(__pyx_t_23)) {
7267  PyObject *__pyx_temp[3] = {__pyx_t_20, __pyx_t_19, __pyx_t_22};
7268  __pyx_t_21 = __Pyx_PyCFunction_FastCall(__pyx_t_23, __pyx_temp+1-__pyx_t_24, 2+__pyx_t_24); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 245, __pyx_L1_error)
7269  __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
7270  __Pyx_GOTREF(__pyx_t_21);
7271  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
7272  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
7273  } else
7274  #endif
7275  {
7276  __pyx_t_25 = PyTuple_New(2+__pyx_t_24); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 245, __pyx_L1_error)
7277  __Pyx_GOTREF(__pyx_t_25);
7278  if (__pyx_t_20) {
7279  __Pyx_GIVEREF(__pyx_t_20); PyTuple_SET_ITEM(__pyx_t_25, 0, __pyx_t_20); __pyx_t_20 = NULL;
7280  }
7281  __Pyx_GIVEREF(__pyx_t_19);
7282  PyTuple_SET_ITEM(__pyx_t_25, 0+__pyx_t_24, __pyx_t_19);
7283  __Pyx_GIVEREF(__pyx_t_22);
7284  PyTuple_SET_ITEM(__pyx_t_25, 1+__pyx_t_24, __pyx_t_22);
7285  __pyx_t_19 = 0;
7286  __pyx_t_22 = 0;
7287  __pyx_t_21 = __Pyx_PyObject_Call(__pyx_t_23, __pyx_t_25, NULL); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 245, __pyx_L1_error)
7288  __Pyx_GOTREF(__pyx_t_21);
7289  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
7290  }
7291  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
7292  __pyx_t_23 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 245, __pyx_L1_error)
7293  __Pyx_GOTREF(__pyx_t_23);
7294  __pyx_t_25 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 245, __pyx_L1_error)
7295  __Pyx_GOTREF(__pyx_t_25);
7296  __pyx_t_22 = PyTuple_New(2); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 245, __pyx_L1_error)
7297  __Pyx_GOTREF(__pyx_t_22);
7298  __Pyx_GIVEREF(__pyx_t_23);
7299  PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_23);
7300  __Pyx_GIVEREF(__pyx_t_25);
7301  PyTuple_SET_ITEM(__pyx_t_22, 1, __pyx_t_25);
7302  __pyx_t_23 = 0;
7303  __pyx_t_25 = 0;
7304  __pyx_t_25 = __Pyx_PyObject_GetItem(__pyx_t_21, __pyx_t_22); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 245, __pyx_L1_error)
7305  __Pyx_GOTREF(__pyx_t_25);
7306  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
7307  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
7308  __pyx_t_22 = PyNumber_Add(__pyx_t_18, __pyx_t_25); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 245, __pyx_L1_error)
7309  __Pyx_GOTREF(__pyx_t_22);
7310  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
7311  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
7312  __pyx_t_25 = __Pyx_PyFloat_AddObjC(__pyx_t_22, __pyx_float_1_0eneg_20, 1.0e-20, 0, 0); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 245, __pyx_L1_error)
7313  __Pyx_GOTREF(__pyx_t_25);
7314  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
7315  __pyx_t_26 = __pyx_PyFloat_AsDouble(__pyx_t_25); if (unlikely((__pyx_t_26 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 245, __pyx_L1_error)
7316  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
7317  __pyx_v_denom = __pyx_t_26;
7318 
7319  /* "subsurfaceTransportFunctions.pyx":246
7320  * numer = 2.0*material_functions[material_left](x[eN,ebN_local,k],t)[I,J]*material_functions[material_right](x[eN,ebN_local,k],t)[I,J]
7321  * denom = material_functions[material_left](x[eN,ebN_local,k],t)[I,J] + material_functions[material_right](x[eN,ebN_local,k],t)[I,J] + 1.0e-20
7322  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom # <<<<<<<<<<<<<<
7323  *
7324  * def evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(double t,
7325  */
7326  if (unlikely(__pyx_v_denom == 0)) {
7327  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
7328  __PYX_ERR(0, 246, __pyx_L1_error)
7329  }
7330  __pyx_t_8 = __pyx_v_eN;
7331  __pyx_t_7 = __pyx_v_ebN_local;
7332  __pyx_t_27 = __pyx_v_k;
7333  __pyx_t_28 = ((__pyx_v_I * __pyx_v_nd) + __pyx_v_J);
7334  __pyx_t_24 = -1;
7335  if (__pyx_t_8 < 0) {
7336  __pyx_t_8 += __pyx_pybuffernd_ebq_vals.diminfo[0].shape;
7337  if (unlikely(__pyx_t_8 < 0)) __pyx_t_24 = 0;
7338  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_ebq_vals.diminfo[0].shape)) __pyx_t_24 = 0;
7339  if (__pyx_t_7 < 0) {
7340  __pyx_t_7 += __pyx_pybuffernd_ebq_vals.diminfo[1].shape;
7341  if (unlikely(__pyx_t_7 < 0)) __pyx_t_24 = 1;
7342  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_ebq_vals.diminfo[1].shape)) __pyx_t_24 = 1;
7343  if (__pyx_t_27 < 0) {
7344  __pyx_t_27 += __pyx_pybuffernd_ebq_vals.diminfo[2].shape;
7345  if (unlikely(__pyx_t_27 < 0)) __pyx_t_24 = 2;
7346  } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_ebq_vals.diminfo[2].shape)) __pyx_t_24 = 2;
7347  if (__pyx_t_28 < 0) {
7348  __pyx_t_28 += __pyx_pybuffernd_ebq_vals.diminfo[3].shape;
7349  if (unlikely(__pyx_t_28 < 0)) __pyx_t_24 = 3;
7350  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_ebq_vals.diminfo[3].shape)) __pyx_t_24 = 3;
7351  if (unlikely(__pyx_t_24 != -1)) {
7352  __Pyx_RaiseBufferIndexError(__pyx_t_24);
7353  __PYX_ERR(0, 246, __pyx_L1_error)
7354  }
7355  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_ebq_vals.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_ebq_vals.diminfo[1].strides, __pyx_t_27, __pyx_pybuffernd_ebq_vals.diminfo[2].strides, __pyx_t_28, __pyx_pybuffernd_ebq_vals.diminfo[3].strides) = (__pyx_v_numer / __pyx_v_denom);
7356  }
7357  }
7358  }
7359  }
7360  }
7361 
7362  /* "subsurfaceTransportFunctions.pyx":219
7363  * material_functions[material_right](x[eN,ebN_local,k],t))
7364  *
7365  * def evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
7366  * double t,
7367  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
7368  */
7369 
7370  /* function exit code */
7371  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7372  goto __pyx_L0;
7373  __pyx_L1_error:;
7374  __Pyx_XDECREF(__pyx_t_18);
7375  __Pyx_XDECREF(__pyx_t_19);
7376  __Pyx_XDECREF(__pyx_t_20);
7377  __Pyx_XDECREF(__pyx_t_21);
7378  __Pyx_XDECREF(__pyx_t_22);
7379  __Pyx_XDECREF(__pyx_t_23);
7380  __Pyx_XDECREF(__pyx_t_25);
7381  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
7382  __Pyx_PyThreadState_declare
7383  __Pyx_PyThreadState_assign
7384  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
7385  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
7386  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
7387  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
7388  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
7389  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
7390  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
7391  __pyx_r = NULL;
7392  goto __pyx_L2;
7393  __pyx_L0:;
7394  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_vals.rcbuffer->pybuffer);
7395  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
7396  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
7397  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
7398  __pyx_L2:;
7399  __Pyx_XGIVEREF(__pyx_r);
7400  __Pyx_RefNannyFinishContext();
7401  return __pyx_r;
7402 }
7403 
7404 /* "subsurfaceTransportFunctions.pyx":248
7405  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
7406  *
7407  * def evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
7408  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
7409  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
7410  */
7411 
7412 /* Python wrapper */
7413 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_25evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
7414 static char __pyx_doc_28subsurfaceTransportFunctions_24evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage[] = "\n loop over quadrature array and evaluate function f(x,t) = 0.5(f^L_j(x,t)+f^R_k(x,t)) assuming element on left \n is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
7415 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_25evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage = {"evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_25evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_24evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage};
7416 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_25evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7417  double __pyx_v_t;
7418  CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray = 0;
7419  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
7420  PyArrayObject *__pyx_v_x = 0;
7421  PyArrayObject *__pyx_v_ebq_global_vals = 0;
7422  PyObject *__pyx_v_material_functions = 0;
7423  int __pyx_lineno = 0;
7424  const char *__pyx_filename = NULL;
7425  int __pyx_clineno = 0;
7426  PyObject *__pyx_r = 0;
7427  __Pyx_RefNannyDeclarations
7428  __Pyx_RefNannySetupContext("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage (wrapper)", 0);
7429  {
7430  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_x,&__pyx_n_s_ebq_global_vals,&__pyx_n_s_material_functions,0};
7431  PyObject* values[6] = {0,0,0,0,0,0};
7432  if (unlikely(__pyx_kwds)) {
7433  Py_ssize_t kw_args;
7434  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7435  switch (pos_args) {
7436  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
7437  CYTHON_FALLTHROUGH;
7438  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
7439  CYTHON_FALLTHROUGH;
7440  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7441  CYTHON_FALLTHROUGH;
7442  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7443  CYTHON_FALLTHROUGH;
7444  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7445  CYTHON_FALLTHROUGH;
7446  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7447  CYTHON_FALLTHROUGH;
7448  case 0: break;
7449  default: goto __pyx_L5_argtuple_error;
7450  }
7451  kw_args = PyDict_Size(__pyx_kwds);
7452  switch (pos_args) {
7453  case 0:
7454  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
7455  else goto __pyx_L5_argtuple_error;
7456  CYTHON_FALLTHROUGH;
7457  case 1:
7458  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
7459  else {
7460  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 6, 6, 1); __PYX_ERR(0, 248, __pyx_L3_error)
7461  }
7462  CYTHON_FALLTHROUGH;
7463  case 2:
7464  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
7465  else {
7466  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 6, 6, 2); __PYX_ERR(0, 248, __pyx_L3_error)
7467  }
7468  CYTHON_FALLTHROUGH;
7469  case 3:
7470  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
7471  else {
7472  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 6, 6, 3); __PYX_ERR(0, 248, __pyx_L3_error)
7473  }
7474  CYTHON_FALLTHROUGH;
7475  case 4:
7476  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ebq_global_vals)) != 0)) kw_args--;
7477  else {
7478  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 6, 6, 4); __PYX_ERR(0, 248, __pyx_L3_error)
7479  }
7480  CYTHON_FALLTHROUGH;
7481  case 5:
7482  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
7483  else {
7484  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 6, 6, 5); __PYX_ERR(0, 248, __pyx_L3_error)
7485  }
7486  }
7487  if (unlikely(kw_args > 0)) {
7488  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage") < 0)) __PYX_ERR(0, 248, __pyx_L3_error)
7489  }
7490  } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
7491  goto __pyx_L5_argtuple_error;
7492  } else {
7493  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7494  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7495  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7496  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7497  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
7498  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
7499  }
7500  __pyx_v_t = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 248, __pyx_L3_error)
7501  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[1]);
7502  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[2]);
7503  __pyx_v_x = ((PyArrayObject *)values[3]);
7504  __pyx_v_ebq_global_vals = ((PyArrayObject *)values[4]);
7505  __pyx_v_material_functions = ((PyObject*)values[5]);
7506  }
7507  goto __pyx_L4_argument_unpacking_done;
7508  __pyx_L5_argtuple_error:;
7509  __Pyx_RaiseArgtupleInvalid("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 248, __pyx_L3_error)
7510  __pyx_L3_error:;
7511  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
7512  __Pyx_RefNannyFinishContext();
7513  return NULL;
7514  __pyx_L4_argument_unpacking_done:;
7515  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) __PYX_ERR(0, 249, __pyx_L1_error)
7516  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) __PYX_ERR(0, 250, __pyx_L1_error)
7517  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 251, __pyx_L1_error)
7518  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_global_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_global_vals", 0))) __PYX_ERR(0, 252, __pyx_L1_error)
7519  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 253, __pyx_L1_error)
7520  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_24evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(__pyx_self, __pyx_v_t, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_x, __pyx_v_ebq_global_vals, __pyx_v_material_functions);
7521 
7522  /* function exit code */
7523  goto __pyx_L0;
7524  __pyx_L1_error:;
7525  __pyx_r = NULL;
7526  __pyx_L0:;
7527  __Pyx_RefNannyFinishContext();
7528  return __pyx_r;
7529 }
7530 
7531 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_24evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions) {
7532  int __pyx_v_ebN;
7533  int __pyx_v_material_left;
7534  int __pyx_v_material_right;
7535  npy_intp __pyx_v_k;
7536  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_global_vals;
7537  __Pyx_Buffer __pyx_pybuffer_ebq_global_vals;
7538  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
7539  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
7540  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
7541  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
7542  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
7543  __Pyx_Buffer __pyx_pybuffer_x;
7544  PyObject *__pyx_r = NULL;
7545  __Pyx_RefNannyDeclarations
7546  npy_intp __pyx_t_1;
7547  npy_intp __pyx_t_2;
7548  int __pyx_t_3;
7549  Py_ssize_t __pyx_t_4;
7550  Py_ssize_t __pyx_t_5;
7551  int __pyx_t_6;
7552  npy_intp __pyx_t_7;
7553  npy_intp __pyx_t_8;
7554  npy_intp __pyx_t_9;
7555  PyObject *__pyx_t_10 = NULL;
7556  PyObject *__pyx_t_11 = NULL;
7557  PyObject *__pyx_t_12 = NULL;
7558  PyObject *__pyx_t_13 = NULL;
7559  PyObject *__pyx_t_14 = NULL;
7560  PyObject *__pyx_t_15 = NULL;
7561  PyObject *__pyx_t_16 = NULL;
7562  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_17;
7563  int __pyx_lineno = 0;
7564  const char *__pyx_filename = NULL;
7565  int __pyx_clineno = 0;
7566  __Pyx_RefNannySetupContext("evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", 0);
7567  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
7568  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
7569  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
7570  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
7571  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
7572  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
7573  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
7574  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
7575  __pyx_pybuffer_x.pybuffer.buf = NULL;
7576  __pyx_pybuffer_x.refcount = 0;
7577  __pyx_pybuffernd_x.data = NULL;
7578  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
7579  __pyx_pybuffer_ebq_global_vals.pybuffer.buf = NULL;
7580  __pyx_pybuffer_ebq_global_vals.refcount = 0;
7581  __pyx_pybuffernd_ebq_global_vals.data = NULL;
7582  __pyx_pybuffernd_ebq_global_vals.rcbuffer = &__pyx_pybuffer_ebq_global_vals;
7583  {
7584  __Pyx_BufFmt_StackElem __pyx_stack[1];
7585  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 248, __pyx_L1_error)
7586  }
7587  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
7588  {
7589  __Pyx_BufFmt_StackElem __pyx_stack[1];
7590  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 248, __pyx_L1_error)
7591  }
7592  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
7593  {
7594  __Pyx_BufFmt_StackElem __pyx_stack[1];
7595  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 248, __pyx_L1_error)
7596  }
7597  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2];
7598  {
7599  __Pyx_BufFmt_StackElem __pyx_stack[1];
7600  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_global_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 248, __pyx_L1_error)
7601  }
7602  __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[1];
7603 
7604  /* "subsurfaceTransportFunctions.pyx":263
7605  * cdef int ebN,material_left,material_right
7606  *
7607  * for ebN in range(x.shape[0]): # <<<<<<<<<<<<<<
7608  * material_left = elementBoundaryTypes[ebN,0]
7609  * material_right= elementBoundaryTypes[ebN,1]
7610  */
7611  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
7612  __pyx_t_2 = __pyx_t_1;
7613  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
7614  __pyx_v_ebN = __pyx_t_3;
7615 
7616  /* "subsurfaceTransportFunctions.pyx":264
7617  *
7618  * for ebN in range(x.shape[0]):
7619  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
7620  * material_right= elementBoundaryTypes[ebN,1]
7621  * for k in range(x.shape[1]):
7622  */
7623  __pyx_t_4 = __pyx_v_ebN;
7624  __pyx_t_5 = 0;
7625  __pyx_t_6 = -1;
7626  if (__pyx_t_4 < 0) {
7627  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
7628  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 0;
7629  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_6 = 0;
7630  if (__pyx_t_5 < 0) {
7631  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
7632  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 1;
7633  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_6 = 1;
7634  if (unlikely(__pyx_t_6 != -1)) {
7635  __Pyx_RaiseBufferIndexError(__pyx_t_6);
7636  __PYX_ERR(0, 264, __pyx_L1_error)
7637  }
7638  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_5, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
7639 
7640  /* "subsurfaceTransportFunctions.pyx":265
7641  * for ebN in range(x.shape[0]):
7642  * material_left = elementBoundaryTypes[ebN,0]
7643  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
7644  * for k in range(x.shape[1]):
7645  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left](x[ebN,k],t)+
7646  */
7647  __pyx_t_5 = __pyx_v_ebN;
7648  __pyx_t_4 = 1;
7649  __pyx_t_6 = -1;
7650  if (__pyx_t_5 < 0) {
7651  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
7652  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 0;
7653  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_6 = 0;
7654  if (__pyx_t_4 < 0) {
7655  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
7656  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 1;
7657  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_6 = 1;
7658  if (unlikely(__pyx_t_6 != -1)) {
7659  __Pyx_RaiseBufferIndexError(__pyx_t_6);
7660  __PYX_ERR(0, 265, __pyx_L1_error)
7661  }
7662  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_4, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
7663 
7664  /* "subsurfaceTransportFunctions.pyx":266
7665  * material_left = elementBoundaryTypes[ebN,0]
7666  * material_right= elementBoundaryTypes[ebN,1]
7667  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
7668  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left](x[ebN,k],t)+
7669  * material_functions[material_right](x[ebN,k],t))
7670  */
7671  __pyx_t_7 = (__pyx_v_x->dimensions[1]);
7672  __pyx_t_8 = __pyx_t_7;
7673  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
7674  __pyx_v_k = __pyx_t_9;
7675 
7676  /* "subsurfaceTransportFunctions.pyx":267
7677  * material_right= elementBoundaryTypes[ebN,1]
7678  * for k in range(x.shape[1]):
7679  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left](x[ebN,k],t)+ # <<<<<<<<<<<<<<
7680  * material_functions[material_right](x[ebN,k],t))
7681  *
7682  */
7683  if (unlikely(__pyx_v_material_functions == Py_None)) {
7684  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
7685  __PYX_ERR(0, 267, __pyx_L1_error)
7686  }
7687  __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 267, __pyx_L1_error)
7688  __Pyx_GOTREF(__pyx_t_11);
7689  __pyx_t_12 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 267, __pyx_L1_error)
7690  __Pyx_GOTREF(__pyx_t_12);
7691  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
7692  __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 267, __pyx_L1_error)
7693  __Pyx_GOTREF(__pyx_t_11);
7694  __pyx_t_13 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_k); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 267, __pyx_L1_error)
7695  __Pyx_GOTREF(__pyx_t_13);
7696  __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 267, __pyx_L1_error)
7697  __Pyx_GOTREF(__pyx_t_14);
7698  __Pyx_GIVEREF(__pyx_t_11);
7699  PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_11);
7700  __Pyx_GIVEREF(__pyx_t_13);
7701  PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_13);
7702  __pyx_t_11 = 0;
7703  __pyx_t_13 = 0;
7704  __pyx_t_13 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_14); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 267, __pyx_L1_error)
7705  __Pyx_GOTREF(__pyx_t_13);
7706  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7707  __pyx_t_14 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 267, __pyx_L1_error)
7708  __Pyx_GOTREF(__pyx_t_14);
7709  __pyx_t_11 = NULL;
7710  __pyx_t_6 = 0;
7711  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
7712  __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_12);
7713  if (likely(__pyx_t_11)) {
7714  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
7715  __Pyx_INCREF(__pyx_t_11);
7716  __Pyx_INCREF(function);
7717  __Pyx_DECREF_SET(__pyx_t_12, function);
7718  __pyx_t_6 = 1;
7719  }
7720  }
7721  #if CYTHON_FAST_PYCALL
7722  if (PyFunction_Check(__pyx_t_12)) {
7723  PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_t_13, __pyx_t_14};
7724  __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 267, __pyx_L1_error)
7725  __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
7726  __Pyx_GOTREF(__pyx_t_10);
7727  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
7728  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7729  } else
7730  #endif
7731  #if CYTHON_FAST_PYCCALL
7732  if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) {
7733  PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_t_13, __pyx_t_14};
7734  __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 267, __pyx_L1_error)
7735  __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
7736  __Pyx_GOTREF(__pyx_t_10);
7737  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
7738  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7739  } else
7740  #endif
7741  {
7742  __pyx_t_15 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 267, __pyx_L1_error)
7743  __Pyx_GOTREF(__pyx_t_15);
7744  if (__pyx_t_11) {
7745  __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_11); __pyx_t_11 = NULL;
7746  }
7747  __Pyx_GIVEREF(__pyx_t_13);
7748  PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_6, __pyx_t_13);
7749  __Pyx_GIVEREF(__pyx_t_14);
7750  PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_6, __pyx_t_14);
7751  __pyx_t_13 = 0;
7752  __pyx_t_14 = 0;
7753  __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_15, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 267, __pyx_L1_error)
7754  __Pyx_GOTREF(__pyx_t_10);
7755  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
7756  }
7757  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
7758 
7759  /* "subsurfaceTransportFunctions.pyx":268
7760  * for k in range(x.shape[1]):
7761  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left](x[ebN,k],t)+
7762  * material_functions[material_right](x[ebN,k],t)) # <<<<<<<<<<<<<<
7763  *
7764  *
7765  */
7766  if (unlikely(__pyx_v_material_functions == Py_None)) {
7767  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
7768  __PYX_ERR(0, 268, __pyx_L1_error)
7769  }
7770  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 268, __pyx_L1_error)
7771  __Pyx_GOTREF(__pyx_t_15);
7772  __pyx_t_14 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_15); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 268, __pyx_L1_error)
7773  __Pyx_GOTREF(__pyx_t_14);
7774  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
7775  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 268, __pyx_L1_error)
7776  __Pyx_GOTREF(__pyx_t_15);
7777  __pyx_t_13 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_k); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 268, __pyx_L1_error)
7778  __Pyx_GOTREF(__pyx_t_13);
7779  __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 268, __pyx_L1_error)
7780  __Pyx_GOTREF(__pyx_t_11);
7781  __Pyx_GIVEREF(__pyx_t_15);
7782  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_15);
7783  __Pyx_GIVEREF(__pyx_t_13);
7784  PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_13);
7785  __pyx_t_15 = 0;
7786  __pyx_t_13 = 0;
7787  __pyx_t_13 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_11); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 268, __pyx_L1_error)
7788  __Pyx_GOTREF(__pyx_t_13);
7789  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
7790  __pyx_t_11 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 268, __pyx_L1_error)
7791  __Pyx_GOTREF(__pyx_t_11);
7792  __pyx_t_15 = NULL;
7793  __pyx_t_6 = 0;
7794  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
7795  __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_14);
7796  if (likely(__pyx_t_15)) {
7797  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
7798  __Pyx_INCREF(__pyx_t_15);
7799  __Pyx_INCREF(function);
7800  __Pyx_DECREF_SET(__pyx_t_14, function);
7801  __pyx_t_6 = 1;
7802  }
7803  }
7804  #if CYTHON_FAST_PYCALL
7805  if (PyFunction_Check(__pyx_t_14)) {
7806  PyObject *__pyx_temp[3] = {__pyx_t_15, __pyx_t_13, __pyx_t_11};
7807  __pyx_t_12 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 268, __pyx_L1_error)
7808  __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
7809  __Pyx_GOTREF(__pyx_t_12);
7810  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
7811  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
7812  } else
7813  #endif
7814  #if CYTHON_FAST_PYCCALL
7815  if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) {
7816  PyObject *__pyx_temp[3] = {__pyx_t_15, __pyx_t_13, __pyx_t_11};
7817  __pyx_t_12 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 268, __pyx_L1_error)
7818  __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
7819  __Pyx_GOTREF(__pyx_t_12);
7820  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
7821  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
7822  } else
7823  #endif
7824  {
7825  __pyx_t_16 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 268, __pyx_L1_error)
7826  __Pyx_GOTREF(__pyx_t_16);
7827  if (__pyx_t_15) {
7828  __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_15); __pyx_t_15 = NULL;
7829  }
7830  __Pyx_GIVEREF(__pyx_t_13);
7831  PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_6, __pyx_t_13);
7832  __Pyx_GIVEREF(__pyx_t_11);
7833  PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_6, __pyx_t_11);
7834  __pyx_t_13 = 0;
7835  __pyx_t_11 = 0;
7836  __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_16, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 268, __pyx_L1_error)
7837  __Pyx_GOTREF(__pyx_t_12);
7838  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
7839  }
7840  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7841 
7842  /* "subsurfaceTransportFunctions.pyx":267
7843  * material_right= elementBoundaryTypes[ebN,1]
7844  * for k in range(x.shape[1]):
7845  * ebq_global_vals[ebN,k] = 0.5*(material_functions[material_left](x[ebN,k],t)+ # <<<<<<<<<<<<<<
7846  * material_functions[material_right](x[ebN,k],t))
7847  *
7848  */
7849  __pyx_t_14 = PyNumber_Add(__pyx_t_10, __pyx_t_12); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 267, __pyx_L1_error)
7850  __Pyx_GOTREF(__pyx_t_14);
7851  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7852  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
7853  __pyx_t_12 = PyNumber_Multiply(__pyx_float_0_5, __pyx_t_14); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 267, __pyx_L1_error)
7854  __Pyx_GOTREF(__pyx_t_12);
7855  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
7856  __pyx_t_17 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_17 == ((npy_double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 267, __pyx_L1_error)
7857  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
7858  __pyx_t_4 = __pyx_v_ebN;
7859  __pyx_t_5 = __pyx_v_k;
7860  __pyx_t_6 = -1;
7861  if (__pyx_t_4 < 0) {
7862  __pyx_t_4 += __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape;
7863  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 0;
7864  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape)) __pyx_t_6 = 0;
7865  if (__pyx_t_5 < 0) {
7866  __pyx_t_5 += __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape;
7867  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 1;
7868  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape)) __pyx_t_6 = 1;
7869  if (unlikely(__pyx_t_6 != -1)) {
7870  __Pyx_RaiseBufferIndexError(__pyx_t_6);
7871  __PYX_ERR(0, 267, __pyx_L1_error)
7872  }
7873  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides, __pyx_t_5, __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides) = __pyx_t_17;
7874  }
7875  }
7876 
7877  /* "subsurfaceTransportFunctions.pyx":248
7878  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
7879  *
7880  * def evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
7881  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
7882  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
7883  */
7884 
7885  /* function exit code */
7886  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7887  goto __pyx_L0;
7888  __pyx_L1_error:;
7889  __Pyx_XDECREF(__pyx_t_10);
7890  __Pyx_XDECREF(__pyx_t_11);
7891  __Pyx_XDECREF(__pyx_t_12);
7892  __Pyx_XDECREF(__pyx_t_13);
7893  __Pyx_XDECREF(__pyx_t_14);
7894  __Pyx_XDECREF(__pyx_t_15);
7895  __Pyx_XDECREF(__pyx_t_16);
7896  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
7897  __Pyx_PyThreadState_declare
7898  __Pyx_PyThreadState_assign
7899  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
7900  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
7901  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
7902  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
7903  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
7904  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
7905  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
7906  __pyx_r = NULL;
7907  goto __pyx_L2;
7908  __pyx_L0:;
7909  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
7910  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
7911  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
7912  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
7913  __pyx_L2:;
7914  __Pyx_XGIVEREF(__pyx_r);
7915  __Pyx_RefNannyFinishContext();
7916  return __pyx_r;
7917 }
7918 
7919 /* "subsurfaceTransportFunctions.pyx":271
7920  *
7921  *
7922  * def evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
7923  * double t,
7924  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
7925  */
7926 
7927 /* Python wrapper */
7928 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_27evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
7929 static char __pyx_doc_28subsurfaceTransportFunctions_26evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage[] = "\n loop over quadrature array and evaluate function \ten f_{mn}(x,t) = f^L_{j,mn}(x,t)f^R_{k,mn}(x,t)/(f^L_{j,mn}(x,t)+f^R_{k,mn})\n assuming element on left is material j and element on right is material k\n\n likely little improvement right now without correct typing of material_functions\n \n ";
7930 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_27evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage = {"evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_27evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_26evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage};
7931 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_27evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7932  int __pyx_v_nd;
7933  double __pyx_v_t;
7934  CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray = 0;
7935  PyArrayObject *__pyx_v_elementBoundaryTypes = 0;
7936  PyArrayObject *__pyx_v_x = 0;
7937  PyArrayObject *__pyx_v_ebq_global_vals = 0;
7938  PyObject *__pyx_v_material_functions = 0;
7939  int __pyx_lineno = 0;
7940  const char *__pyx_filename = NULL;
7941  int __pyx_clineno = 0;
7942  PyObject *__pyx_r = 0;
7943  __Pyx_RefNannyDeclarations
7944  __Pyx_RefNannySetupContext("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage (wrapper)", 0);
7945  {
7946  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nd,&__pyx_n_s_t,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryTypes,&__pyx_n_s_x,&__pyx_n_s_ebq_global_vals,&__pyx_n_s_material_functions,0};
7947  PyObject* values[7] = {0,0,0,0,0,0,0};
7948  if (unlikely(__pyx_kwds)) {
7949  Py_ssize_t kw_args;
7950  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7951  switch (pos_args) {
7952  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
7953  CYTHON_FALLTHROUGH;
7954  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
7955  CYTHON_FALLTHROUGH;
7956  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
7957  CYTHON_FALLTHROUGH;
7958  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7959  CYTHON_FALLTHROUGH;
7960  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7961  CYTHON_FALLTHROUGH;
7962  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7963  CYTHON_FALLTHROUGH;
7964  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7965  CYTHON_FALLTHROUGH;
7966  case 0: break;
7967  default: goto __pyx_L5_argtuple_error;
7968  }
7969  kw_args = PyDict_Size(__pyx_kwds);
7970  switch (pos_args) {
7971  case 0:
7972  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nd)) != 0)) kw_args--;
7973  else goto __pyx_L5_argtuple_error;
7974  CYTHON_FALLTHROUGH;
7975  case 1:
7976  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
7977  else {
7978  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 7, 7, 1); __PYX_ERR(0, 271, __pyx_L3_error)
7979  }
7980  CYTHON_FALLTHROUGH;
7981  case 2:
7982  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
7983  else {
7984  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 7, 7, 2); __PYX_ERR(0, 271, __pyx_L3_error)
7985  }
7986  CYTHON_FALLTHROUGH;
7987  case 3:
7988  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryTypes)) != 0)) kw_args--;
7989  else {
7990  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 7, 7, 3); __PYX_ERR(0, 271, __pyx_L3_error)
7991  }
7992  CYTHON_FALLTHROUGH;
7993  case 4:
7994  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
7995  else {
7996  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 7, 7, 4); __PYX_ERR(0, 271, __pyx_L3_error)
7997  }
7998  CYTHON_FALLTHROUGH;
7999  case 5:
8000  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ebq_global_vals)) != 0)) kw_args--;
8001  else {
8002  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 7, 7, 5); __PYX_ERR(0, 271, __pyx_L3_error)
8003  }
8004  CYTHON_FALLTHROUGH;
8005  case 6:
8006  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_material_functions)) != 0)) kw_args--;
8007  else {
8008  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 7, 7, 6); __PYX_ERR(0, 271, __pyx_L3_error)
8009  }
8010  }
8011  if (unlikely(kw_args > 0)) {
8012  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage") < 0)) __PYX_ERR(0, 271, __pyx_L3_error)
8013  }
8014  } else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
8015  goto __pyx_L5_argtuple_error;
8016  } else {
8017  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8018  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8019  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8020  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8021  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
8022  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
8023  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
8024  }
8025  __pyx_v_nd = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_nd == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 271, __pyx_L3_error)
8026  __pyx_v_t = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 272, __pyx_L3_error)
8027  __pyx_v_elementBoundariesArray = ((PyArrayObject *)values[2]);
8028  __pyx_v_elementBoundaryTypes = ((PyArrayObject *)values[3]);
8029  __pyx_v_x = ((PyArrayObject *)values[4]);
8030  __pyx_v_ebq_global_vals = ((PyArrayObject *)values[5]);
8031  __pyx_v_material_functions = ((PyObject*)values[6]);
8032  }
8033  goto __pyx_L4_argument_unpacking_done;
8034  __pyx_L5_argtuple_error:;
8035  __Pyx_RaiseArgtupleInvalid("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 271, __pyx_L3_error)
8036  __pyx_L3_error:;
8037  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
8038  __Pyx_RefNannyFinishContext();
8039  return NULL;
8040  __pyx_L4_argument_unpacking_done:;
8041  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundariesArray), __pyx_ptype_5numpy_ndarray, 1, "elementBoundariesArray", 0))) __PYX_ERR(0, 273, __pyx_L1_error)
8042  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBoundaryTypes), __pyx_ptype_5numpy_ndarray, 1, "elementBoundaryTypes", 0))) __PYX_ERR(0, 274, __pyx_L1_error)
8043  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 275, __pyx_L1_error)
8044  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ebq_global_vals), __pyx_ptype_5numpy_ndarray, 1, "ebq_global_vals", 0))) __PYX_ERR(0, 276, __pyx_L1_error)
8045  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_material_functions), (&PyDict_Type), 1, "material_functions", 1))) __PYX_ERR(0, 277, __pyx_L1_error)
8046  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_26evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(__pyx_self, __pyx_v_nd, __pyx_v_t, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryTypes, __pyx_v_x, __pyx_v_ebq_global_vals, __pyx_v_material_functions);
8047 
8048  /* function exit code */
8049  goto __pyx_L0;
8050  __pyx_L1_error:;
8051  __pyx_r = NULL;
8052  __pyx_L0:;
8053  __Pyx_RefNannyFinishContext();
8054  return __pyx_r;
8055 }
8056 
8057 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_26evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_nd, double __pyx_v_t, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBoundariesArray, PyArrayObject *__pyx_v_elementBoundaryTypes, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_ebq_global_vals, PyObject *__pyx_v_material_functions) {
8058  int __pyx_v_ebN;
8059  int __pyx_v_k;
8060  int __pyx_v_material_left;
8061  int __pyx_v_material_right;
8062  int __pyx_v_I;
8063  int __pyx_v_J;
8064  double __pyx_v_numer;
8065  double __pyx_v_denom;
8066  __Pyx_LocalBuf_ND __pyx_pybuffernd_ebq_global_vals;
8067  __Pyx_Buffer __pyx_pybuffer_ebq_global_vals;
8068  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundariesArray;
8069  __Pyx_Buffer __pyx_pybuffer_elementBoundariesArray;
8070  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBoundaryTypes;
8071  __Pyx_Buffer __pyx_pybuffer_elementBoundaryTypes;
8072  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
8073  __Pyx_Buffer __pyx_pybuffer_x;
8074  PyObject *__pyx_r = NULL;
8075  __Pyx_RefNannyDeclarations
8076  npy_intp __pyx_t_1;
8077  npy_intp __pyx_t_2;
8078  int __pyx_t_3;
8079  Py_ssize_t __pyx_t_4;
8080  Py_ssize_t __pyx_t_5;
8081  int __pyx_t_6;
8082  npy_intp __pyx_t_7;
8083  npy_intp __pyx_t_8;
8084  int __pyx_t_9;
8085  int __pyx_t_10;
8086  int __pyx_t_11;
8087  int __pyx_t_12;
8088  int __pyx_t_13;
8089  int __pyx_t_14;
8090  PyObject *__pyx_t_15 = NULL;
8091  PyObject *__pyx_t_16 = NULL;
8092  PyObject *__pyx_t_17 = NULL;
8093  PyObject *__pyx_t_18 = NULL;
8094  PyObject *__pyx_t_19 = NULL;
8095  int __pyx_t_20;
8096  PyObject *__pyx_t_21 = NULL;
8097  PyObject *__pyx_t_22 = NULL;
8098  double __pyx_t_23;
8099  Py_ssize_t __pyx_t_24;
8100  int __pyx_lineno = 0;
8101  const char *__pyx_filename = NULL;
8102  int __pyx_clineno = 0;
8103  __Pyx_RefNannySetupContext("evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", 0);
8104  __pyx_pybuffer_elementBoundariesArray.pybuffer.buf = NULL;
8105  __pyx_pybuffer_elementBoundariesArray.refcount = 0;
8106  __pyx_pybuffernd_elementBoundariesArray.data = NULL;
8107  __pyx_pybuffernd_elementBoundariesArray.rcbuffer = &__pyx_pybuffer_elementBoundariesArray;
8108  __pyx_pybuffer_elementBoundaryTypes.pybuffer.buf = NULL;
8109  __pyx_pybuffer_elementBoundaryTypes.refcount = 0;
8110  __pyx_pybuffernd_elementBoundaryTypes.data = NULL;
8111  __pyx_pybuffernd_elementBoundaryTypes.rcbuffer = &__pyx_pybuffer_elementBoundaryTypes;
8112  __pyx_pybuffer_x.pybuffer.buf = NULL;
8113  __pyx_pybuffer_x.refcount = 0;
8114  __pyx_pybuffernd_x.data = NULL;
8115  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
8116  __pyx_pybuffer_ebq_global_vals.pybuffer.buf = NULL;
8117  __pyx_pybuffer_ebq_global_vals.refcount = 0;
8118  __pyx_pybuffernd_ebq_global_vals.data = NULL;
8119  __pyx_pybuffernd_ebq_global_vals.rcbuffer = &__pyx_pybuffer_ebq_global_vals;
8120  {
8121  __Pyx_BufFmt_StackElem __pyx_stack[1];
8122  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundariesArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 271, __pyx_L1_error)
8123  }
8124  __pyx_pybuffernd_elementBoundariesArray.diminfo[0].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[0].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].strides = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundariesArray.diminfo[1].shape = __pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer.shape[1];
8125  {
8126  __Pyx_BufFmt_StackElem __pyx_stack[1];
8127  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBoundaryTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 271, __pyx_L1_error)
8128  }
8129  __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape = __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.shape[1];
8130  {
8131  __Pyx_BufFmt_StackElem __pyx_stack[1];
8132  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 271, __pyx_L1_error)
8133  }
8134  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_x.diminfo[3].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_x.diminfo[3].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[3];
8135  {
8136  __Pyx_BufFmt_StackElem __pyx_stack[1];
8137  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer, (PyObject*)__pyx_v_ebq_global_vals, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 271, __pyx_L1_error)
8138  }
8139  __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_ebq_global_vals.diminfo[2].strides = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_ebq_global_vals.diminfo[2].shape = __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.shape[2];
8140 
8141  /* "subsurfaceTransportFunctions.pyx":288
8142  * cdef double numer,denom
8143  *
8144  * for ebN in range(x.shape[0]): # <<<<<<<<<<<<<<
8145  * material_left = elementBoundaryTypes[ebN,0]
8146  * material_right= elementBoundaryTypes[ebN,1]
8147  */
8148  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
8149  __pyx_t_2 = __pyx_t_1;
8150  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
8151  __pyx_v_ebN = __pyx_t_3;
8152 
8153  /* "subsurfaceTransportFunctions.pyx":289
8154  *
8155  * for ebN in range(x.shape[0]):
8156  * material_left = elementBoundaryTypes[ebN,0] # <<<<<<<<<<<<<<
8157  * material_right= elementBoundaryTypes[ebN,1]
8158  * for k in range(x.shape[1]):
8159  */
8160  __pyx_t_4 = __pyx_v_ebN;
8161  __pyx_t_5 = 0;
8162  __pyx_t_6 = -1;
8163  if (__pyx_t_4 < 0) {
8164  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
8165  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 0;
8166  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_6 = 0;
8167  if (__pyx_t_5 < 0) {
8168  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
8169  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 1;
8170  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_6 = 1;
8171  if (unlikely(__pyx_t_6 != -1)) {
8172  __Pyx_RaiseBufferIndexError(__pyx_t_6);
8173  __PYX_ERR(0, 289, __pyx_L1_error)
8174  }
8175  __pyx_v_material_left = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_5, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
8176 
8177  /* "subsurfaceTransportFunctions.pyx":290
8178  * for ebN in range(x.shape[0]):
8179  * material_left = elementBoundaryTypes[ebN,0]
8180  * material_right= elementBoundaryTypes[ebN,1] # <<<<<<<<<<<<<<
8181  * for k in range(x.shape[1]):
8182  * for I in range(nd):
8183  */
8184  __pyx_t_5 = __pyx_v_ebN;
8185  __pyx_t_4 = 1;
8186  __pyx_t_6 = -1;
8187  if (__pyx_t_5 < 0) {
8188  __pyx_t_5 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape;
8189  if (unlikely(__pyx_t_5 < 0)) __pyx_t_6 = 0;
8190  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].shape)) __pyx_t_6 = 0;
8191  if (__pyx_t_4 < 0) {
8192  __pyx_t_4 += __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape;
8193  if (unlikely(__pyx_t_4 < 0)) __pyx_t_6 = 1;
8194  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].shape)) __pyx_t_6 = 1;
8195  if (unlikely(__pyx_t_6 != -1)) {
8196  __Pyx_RaiseBufferIndexError(__pyx_t_6);
8197  __PYX_ERR(0, 290, __pyx_L1_error)
8198  }
8199  __pyx_v_material_right = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_elementBoundaryTypes.diminfo[0].strides, __pyx_t_4, __pyx_pybuffernd_elementBoundaryTypes.diminfo[1].strides));
8200 
8201  /* "subsurfaceTransportFunctions.pyx":291
8202  * material_left = elementBoundaryTypes[ebN,0]
8203  * material_right= elementBoundaryTypes[ebN,1]
8204  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
8205  * for I in range(nd):
8206  * for J in range(nd):
8207  */
8208  __pyx_t_7 = (__pyx_v_x->dimensions[1]);
8209  __pyx_t_8 = __pyx_t_7;
8210  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_8; __pyx_t_6+=1) {
8211  __pyx_v_k = __pyx_t_6;
8212 
8213  /* "subsurfaceTransportFunctions.pyx":292
8214  * material_right= elementBoundaryTypes[ebN,1]
8215  * for k in range(x.shape[1]):
8216  * for I in range(nd): # <<<<<<<<<<<<<<
8217  * for J in range(nd):
8218  * numer = 2.0*material_functions[material_left](x[ebN,k],t)[I,J]*material_functions[material_right](x[ebN,k],t)[I,J]
8219  */
8220  __pyx_t_9 = __pyx_v_nd;
8221  __pyx_t_10 = __pyx_t_9;
8222  for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
8223  __pyx_v_I = __pyx_t_11;
8224 
8225  /* "subsurfaceTransportFunctions.pyx":293
8226  * for k in range(x.shape[1]):
8227  * for I in range(nd):
8228  * for J in range(nd): # <<<<<<<<<<<<<<
8229  * numer = 2.0*material_functions[material_left](x[ebN,k],t)[I,J]*material_functions[material_right](x[ebN,k],t)[I,J]
8230  * denom = material_functions[material_left](x[ebN,k],t)[I,J] + material_functions[material_right](x[ebN,k],t)[I,J] + 1.0e-20
8231  */
8232  __pyx_t_12 = __pyx_v_nd;
8233  __pyx_t_13 = __pyx_t_12;
8234  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
8235  __pyx_v_J = __pyx_t_14;
8236 
8237  /* "subsurfaceTransportFunctions.pyx":294
8238  * for I in range(nd):
8239  * for J in range(nd):
8240  * numer = 2.0*material_functions[material_left](x[ebN,k],t)[I,J]*material_functions[material_right](x[ebN,k],t)[I,J] # <<<<<<<<<<<<<<
8241  * denom = material_functions[material_left](x[ebN,k],t)[I,J] + material_functions[material_right](x[ebN,k],t)[I,J] + 1.0e-20
8242  * ebq_global_vals[ebN,k,I*nd+J] = numer/denom
8243  */
8244  if (unlikely(__pyx_v_material_functions == Py_None)) {
8245  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
8246  __PYX_ERR(0, 294, __pyx_L1_error)
8247  }
8248  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 294, __pyx_L1_error)
8249  __Pyx_GOTREF(__pyx_t_16);
8250  __pyx_t_17 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_16); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 294, __pyx_L1_error)
8251  __Pyx_GOTREF(__pyx_t_17);
8252  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
8253  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 294, __pyx_L1_error)
8254  __Pyx_GOTREF(__pyx_t_16);
8255  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 294, __pyx_L1_error)
8256  __Pyx_GOTREF(__pyx_t_18);
8257  __pyx_t_19 = PyTuple_New(2); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 294, __pyx_L1_error)
8258  __Pyx_GOTREF(__pyx_t_19);
8259  __Pyx_GIVEREF(__pyx_t_16);
8260  PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_16);
8261  __Pyx_GIVEREF(__pyx_t_18);
8262  PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_t_18);
8263  __pyx_t_16 = 0;
8264  __pyx_t_18 = 0;
8265  __pyx_t_18 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_19); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 294, __pyx_L1_error)
8266  __Pyx_GOTREF(__pyx_t_18);
8267  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
8268  __pyx_t_19 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 294, __pyx_L1_error)
8269  __Pyx_GOTREF(__pyx_t_19);
8270  __pyx_t_16 = NULL;
8271  __pyx_t_20 = 0;
8272  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_17))) {
8273  __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_17);
8274  if (likely(__pyx_t_16)) {
8275  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_17);
8276  __Pyx_INCREF(__pyx_t_16);
8277  __Pyx_INCREF(function);
8278  __Pyx_DECREF_SET(__pyx_t_17, function);
8279  __pyx_t_20 = 1;
8280  }
8281  }
8282  #if CYTHON_FAST_PYCALL
8283  if (PyFunction_Check(__pyx_t_17)) {
8284  PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_t_18, __pyx_t_19};
8285  __pyx_t_15 = __Pyx_PyFunction_FastCall(__pyx_t_17, __pyx_temp+1-__pyx_t_20, 2+__pyx_t_20); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 294, __pyx_L1_error)
8286  __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
8287  __Pyx_GOTREF(__pyx_t_15);
8288  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
8289  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
8290  } else
8291  #endif
8292  #if CYTHON_FAST_PYCCALL
8293  if (__Pyx_PyFastCFunction_Check(__pyx_t_17)) {
8294  PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_t_18, __pyx_t_19};
8295  __pyx_t_15 = __Pyx_PyCFunction_FastCall(__pyx_t_17, __pyx_temp+1-__pyx_t_20, 2+__pyx_t_20); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 294, __pyx_L1_error)
8296  __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
8297  __Pyx_GOTREF(__pyx_t_15);
8298  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
8299  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
8300  } else
8301  #endif
8302  {
8303  __pyx_t_21 = PyTuple_New(2+__pyx_t_20); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 294, __pyx_L1_error)
8304  __Pyx_GOTREF(__pyx_t_21);
8305  if (__pyx_t_16) {
8306  __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_16); __pyx_t_16 = NULL;
8307  }
8308  __Pyx_GIVEREF(__pyx_t_18);
8309  PyTuple_SET_ITEM(__pyx_t_21, 0+__pyx_t_20, __pyx_t_18);
8310  __Pyx_GIVEREF(__pyx_t_19);
8311  PyTuple_SET_ITEM(__pyx_t_21, 1+__pyx_t_20, __pyx_t_19);
8312  __pyx_t_18 = 0;
8313  __pyx_t_19 = 0;
8314  __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_17, __pyx_t_21, NULL); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 294, __pyx_L1_error)
8315  __Pyx_GOTREF(__pyx_t_15);
8316  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8317  }
8318  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
8319  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 294, __pyx_L1_error)
8320  __Pyx_GOTREF(__pyx_t_17);
8321  __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 294, __pyx_L1_error)
8322  __Pyx_GOTREF(__pyx_t_21);
8323  __pyx_t_19 = PyTuple_New(2); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 294, __pyx_L1_error)
8324  __Pyx_GOTREF(__pyx_t_19);
8325  __Pyx_GIVEREF(__pyx_t_17);
8326  PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_17);
8327  __Pyx_GIVEREF(__pyx_t_21);
8328  PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_t_21);
8329  __pyx_t_17 = 0;
8330  __pyx_t_21 = 0;
8331  __pyx_t_21 = __Pyx_PyObject_GetItem(__pyx_t_15, __pyx_t_19); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 294, __pyx_L1_error)
8332  __Pyx_GOTREF(__pyx_t_21);
8333  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
8334  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
8335  __pyx_t_19 = PyNumber_Multiply(__pyx_float_2_0, __pyx_t_21); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 294, __pyx_L1_error)
8336  __Pyx_GOTREF(__pyx_t_19);
8337  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8338  if (unlikely(__pyx_v_material_functions == Py_None)) {
8339  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
8340  __PYX_ERR(0, 294, __pyx_L1_error)
8341  }
8342  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 294, __pyx_L1_error)
8343  __Pyx_GOTREF(__pyx_t_15);
8344  __pyx_t_17 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_15); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 294, __pyx_L1_error)
8345  __Pyx_GOTREF(__pyx_t_17);
8346  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
8347  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 294, __pyx_L1_error)
8348  __Pyx_GOTREF(__pyx_t_15);
8349  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 294, __pyx_L1_error)
8350  __Pyx_GOTREF(__pyx_t_18);
8351  __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 294, __pyx_L1_error)
8352  __Pyx_GOTREF(__pyx_t_16);
8353  __Pyx_GIVEREF(__pyx_t_15);
8354  PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_15);
8355  __Pyx_GIVEREF(__pyx_t_18);
8356  PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_18);
8357  __pyx_t_15 = 0;
8358  __pyx_t_18 = 0;
8359  __pyx_t_18 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_16); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 294, __pyx_L1_error)
8360  __Pyx_GOTREF(__pyx_t_18);
8361  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
8362  __pyx_t_16 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 294, __pyx_L1_error)
8363  __Pyx_GOTREF(__pyx_t_16);
8364  __pyx_t_15 = NULL;
8365  __pyx_t_20 = 0;
8366  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_17))) {
8367  __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_17);
8368  if (likely(__pyx_t_15)) {
8369  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_17);
8370  __Pyx_INCREF(__pyx_t_15);
8371  __Pyx_INCREF(function);
8372  __Pyx_DECREF_SET(__pyx_t_17, function);
8373  __pyx_t_20 = 1;
8374  }
8375  }
8376  #if CYTHON_FAST_PYCALL
8377  if (PyFunction_Check(__pyx_t_17)) {
8378  PyObject *__pyx_temp[3] = {__pyx_t_15, __pyx_t_18, __pyx_t_16};
8379  __pyx_t_21 = __Pyx_PyFunction_FastCall(__pyx_t_17, __pyx_temp+1-__pyx_t_20, 2+__pyx_t_20); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 294, __pyx_L1_error)
8380  __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
8381  __Pyx_GOTREF(__pyx_t_21);
8382  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
8383  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
8384  } else
8385  #endif
8386  #if CYTHON_FAST_PYCCALL
8387  if (__Pyx_PyFastCFunction_Check(__pyx_t_17)) {
8388  PyObject *__pyx_temp[3] = {__pyx_t_15, __pyx_t_18, __pyx_t_16};
8389  __pyx_t_21 = __Pyx_PyCFunction_FastCall(__pyx_t_17, __pyx_temp+1-__pyx_t_20, 2+__pyx_t_20); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 294, __pyx_L1_error)
8390  __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
8391  __Pyx_GOTREF(__pyx_t_21);
8392  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
8393  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
8394  } else
8395  #endif
8396  {
8397  __pyx_t_22 = PyTuple_New(2+__pyx_t_20); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 294, __pyx_L1_error)
8398  __Pyx_GOTREF(__pyx_t_22);
8399  if (__pyx_t_15) {
8400  __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_15); __pyx_t_15 = NULL;
8401  }
8402  __Pyx_GIVEREF(__pyx_t_18);
8403  PyTuple_SET_ITEM(__pyx_t_22, 0+__pyx_t_20, __pyx_t_18);
8404  __Pyx_GIVEREF(__pyx_t_16);
8405  PyTuple_SET_ITEM(__pyx_t_22, 1+__pyx_t_20, __pyx_t_16);
8406  __pyx_t_18 = 0;
8407  __pyx_t_16 = 0;
8408  __pyx_t_21 = __Pyx_PyObject_Call(__pyx_t_17, __pyx_t_22, NULL); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 294, __pyx_L1_error)
8409  __Pyx_GOTREF(__pyx_t_21);
8410  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
8411  }
8412  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
8413  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 294, __pyx_L1_error)
8414  __Pyx_GOTREF(__pyx_t_17);
8415  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 294, __pyx_L1_error)
8416  __Pyx_GOTREF(__pyx_t_22);
8417  __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 294, __pyx_L1_error)
8418  __Pyx_GOTREF(__pyx_t_16);
8419  __Pyx_GIVEREF(__pyx_t_17);
8420  PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_17);
8421  __Pyx_GIVEREF(__pyx_t_22);
8422  PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_22);
8423  __pyx_t_17 = 0;
8424  __pyx_t_22 = 0;
8425  __pyx_t_22 = __Pyx_PyObject_GetItem(__pyx_t_21, __pyx_t_16); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 294, __pyx_L1_error)
8426  __Pyx_GOTREF(__pyx_t_22);
8427  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8428  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
8429  __pyx_t_16 = PyNumber_Multiply(__pyx_t_19, __pyx_t_22); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 294, __pyx_L1_error)
8430  __Pyx_GOTREF(__pyx_t_16);
8431  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
8432  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
8433  __pyx_t_23 = __pyx_PyFloat_AsDouble(__pyx_t_16); if (unlikely((__pyx_t_23 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 294, __pyx_L1_error)
8434  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
8435  __pyx_v_numer = __pyx_t_23;
8436 
8437  /* "subsurfaceTransportFunctions.pyx":295
8438  * for J in range(nd):
8439  * numer = 2.0*material_functions[material_left](x[ebN,k],t)[I,J]*material_functions[material_right](x[ebN,k],t)[I,J]
8440  * denom = material_functions[material_left](x[ebN,k],t)[I,J] + material_functions[material_right](x[ebN,k],t)[I,J] + 1.0e-20 # <<<<<<<<<<<<<<
8441  * ebq_global_vals[ebN,k,I*nd+J] = numer/denom
8442  *
8443  */
8444  if (unlikely(__pyx_v_material_functions == Py_None)) {
8445  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
8446  __PYX_ERR(0, 295, __pyx_L1_error)
8447  }
8448  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_material_left); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 295, __pyx_L1_error)
8449  __Pyx_GOTREF(__pyx_t_22);
8450  __pyx_t_19 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_22); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 295, __pyx_L1_error)
8451  __Pyx_GOTREF(__pyx_t_19);
8452  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
8453  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 295, __pyx_L1_error)
8454  __Pyx_GOTREF(__pyx_t_22);
8455  __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 295, __pyx_L1_error)
8456  __Pyx_GOTREF(__pyx_t_21);
8457  __pyx_t_17 = PyTuple_New(2); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 295, __pyx_L1_error)
8458  __Pyx_GOTREF(__pyx_t_17);
8459  __Pyx_GIVEREF(__pyx_t_22);
8460  PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_22);
8461  __Pyx_GIVEREF(__pyx_t_21);
8462  PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_21);
8463  __pyx_t_22 = 0;
8464  __pyx_t_21 = 0;
8465  __pyx_t_21 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_17); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 295, __pyx_L1_error)
8466  __Pyx_GOTREF(__pyx_t_21);
8467  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
8468  __pyx_t_17 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 295, __pyx_L1_error)
8469  __Pyx_GOTREF(__pyx_t_17);
8470  __pyx_t_22 = NULL;
8471  __pyx_t_20 = 0;
8472  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_19))) {
8473  __pyx_t_22 = PyMethod_GET_SELF(__pyx_t_19);
8474  if (likely(__pyx_t_22)) {
8475  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_19);
8476  __Pyx_INCREF(__pyx_t_22);
8477  __Pyx_INCREF(function);
8478  __Pyx_DECREF_SET(__pyx_t_19, function);
8479  __pyx_t_20 = 1;
8480  }
8481  }
8482  #if CYTHON_FAST_PYCALL
8483  if (PyFunction_Check(__pyx_t_19)) {
8484  PyObject *__pyx_temp[3] = {__pyx_t_22, __pyx_t_21, __pyx_t_17};
8485  __pyx_t_16 = __Pyx_PyFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_20, 2+__pyx_t_20); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 295, __pyx_L1_error)
8486  __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
8487  __Pyx_GOTREF(__pyx_t_16);
8488  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8489  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
8490  } else
8491  #endif
8492  #if CYTHON_FAST_PYCCALL
8493  if (__Pyx_PyFastCFunction_Check(__pyx_t_19)) {
8494  PyObject *__pyx_temp[3] = {__pyx_t_22, __pyx_t_21, __pyx_t_17};
8495  __pyx_t_16 = __Pyx_PyCFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_20, 2+__pyx_t_20); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 295, __pyx_L1_error)
8496  __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
8497  __Pyx_GOTREF(__pyx_t_16);
8498  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8499  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
8500  } else
8501  #endif
8502  {
8503  __pyx_t_18 = PyTuple_New(2+__pyx_t_20); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 295, __pyx_L1_error)
8504  __Pyx_GOTREF(__pyx_t_18);
8505  if (__pyx_t_22) {
8506  __Pyx_GIVEREF(__pyx_t_22); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_22); __pyx_t_22 = NULL;
8507  }
8508  __Pyx_GIVEREF(__pyx_t_21);
8509  PyTuple_SET_ITEM(__pyx_t_18, 0+__pyx_t_20, __pyx_t_21);
8510  __Pyx_GIVEREF(__pyx_t_17);
8511  PyTuple_SET_ITEM(__pyx_t_18, 1+__pyx_t_20, __pyx_t_17);
8512  __pyx_t_21 = 0;
8513  __pyx_t_17 = 0;
8514  __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_19, __pyx_t_18, NULL); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 295, __pyx_L1_error)
8515  __Pyx_GOTREF(__pyx_t_16);
8516  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
8517  }
8518  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
8519  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 295, __pyx_L1_error)
8520  __Pyx_GOTREF(__pyx_t_19);
8521  __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 295, __pyx_L1_error)
8522  __Pyx_GOTREF(__pyx_t_18);
8523  __pyx_t_17 = PyTuple_New(2); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 295, __pyx_L1_error)
8524  __Pyx_GOTREF(__pyx_t_17);
8525  __Pyx_GIVEREF(__pyx_t_19);
8526  PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_19);
8527  __Pyx_GIVEREF(__pyx_t_18);
8528  PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_18);
8529  __pyx_t_19 = 0;
8530  __pyx_t_18 = 0;
8531  __pyx_t_18 = __Pyx_PyObject_GetItem(__pyx_t_16, __pyx_t_17); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 295, __pyx_L1_error)
8532  __Pyx_GOTREF(__pyx_t_18);
8533  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
8534  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
8535  if (unlikely(__pyx_v_material_functions == Py_None)) {
8536  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
8537  __PYX_ERR(0, 295, __pyx_L1_error)
8538  }
8539  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_material_right); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 295, __pyx_L1_error)
8540  __Pyx_GOTREF(__pyx_t_16);
8541  __pyx_t_19 = __Pyx_PyDict_GetItem(__pyx_v_material_functions, __pyx_t_16); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 295, __pyx_L1_error)
8542  __Pyx_GOTREF(__pyx_t_19);
8543  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
8544  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 295, __pyx_L1_error)
8545  __Pyx_GOTREF(__pyx_t_16);
8546  __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 295, __pyx_L1_error)
8547  __Pyx_GOTREF(__pyx_t_21);
8548  __pyx_t_22 = PyTuple_New(2); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 295, __pyx_L1_error)
8549  __Pyx_GOTREF(__pyx_t_22);
8550  __Pyx_GIVEREF(__pyx_t_16);
8551  PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_16);
8552  __Pyx_GIVEREF(__pyx_t_21);
8553  PyTuple_SET_ITEM(__pyx_t_22, 1, __pyx_t_21);
8554  __pyx_t_16 = 0;
8555  __pyx_t_21 = 0;
8556  __pyx_t_21 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_x), __pyx_t_22); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 295, __pyx_L1_error)
8557  __Pyx_GOTREF(__pyx_t_21);
8558  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
8559  __pyx_t_22 = PyFloat_FromDouble(__pyx_v_t); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 295, __pyx_L1_error)
8560  __Pyx_GOTREF(__pyx_t_22);
8561  __pyx_t_16 = NULL;
8562  __pyx_t_20 = 0;
8563  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_19))) {
8564  __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_19);
8565  if (likely(__pyx_t_16)) {
8566  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_19);
8567  __Pyx_INCREF(__pyx_t_16);
8568  __Pyx_INCREF(function);
8569  __Pyx_DECREF_SET(__pyx_t_19, function);
8570  __pyx_t_20 = 1;
8571  }
8572  }
8573  #if CYTHON_FAST_PYCALL
8574  if (PyFunction_Check(__pyx_t_19)) {
8575  PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_t_21, __pyx_t_22};
8576  __pyx_t_17 = __Pyx_PyFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_20, 2+__pyx_t_20); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 295, __pyx_L1_error)
8577  __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
8578  __Pyx_GOTREF(__pyx_t_17);
8579  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8580  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
8581  } else
8582  #endif
8583  #if CYTHON_FAST_PYCCALL
8584  if (__Pyx_PyFastCFunction_Check(__pyx_t_19)) {
8585  PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_t_21, __pyx_t_22};
8586  __pyx_t_17 = __Pyx_PyCFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_20, 2+__pyx_t_20); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 295, __pyx_L1_error)
8587  __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
8588  __Pyx_GOTREF(__pyx_t_17);
8589  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
8590  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
8591  } else
8592  #endif
8593  {
8594  __pyx_t_15 = PyTuple_New(2+__pyx_t_20); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 295, __pyx_L1_error)
8595  __Pyx_GOTREF(__pyx_t_15);
8596  if (__pyx_t_16) {
8597  __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_16); __pyx_t_16 = NULL;
8598  }
8599  __Pyx_GIVEREF(__pyx_t_21);
8600  PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_20, __pyx_t_21);
8601  __Pyx_GIVEREF(__pyx_t_22);
8602  PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_20, __pyx_t_22);
8603  __pyx_t_21 = 0;
8604  __pyx_t_22 = 0;
8605  __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_19, __pyx_t_15, NULL); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 295, __pyx_L1_error)
8606  __Pyx_GOTREF(__pyx_t_17);
8607  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
8608  }
8609  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
8610  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_I); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 295, __pyx_L1_error)
8611  __Pyx_GOTREF(__pyx_t_19);
8612  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_J); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 295, __pyx_L1_error)
8613  __Pyx_GOTREF(__pyx_t_15);
8614  __pyx_t_22 = PyTuple_New(2); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 295, __pyx_L1_error)
8615  __Pyx_GOTREF(__pyx_t_22);
8616  __Pyx_GIVEREF(__pyx_t_19);
8617  PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_19);
8618  __Pyx_GIVEREF(__pyx_t_15);
8619  PyTuple_SET_ITEM(__pyx_t_22, 1, __pyx_t_15);
8620  __pyx_t_19 = 0;
8621  __pyx_t_15 = 0;
8622  __pyx_t_15 = __Pyx_PyObject_GetItem(__pyx_t_17, __pyx_t_22); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 295, __pyx_L1_error)
8623  __Pyx_GOTREF(__pyx_t_15);
8624  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
8625  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
8626  __pyx_t_22 = PyNumber_Add(__pyx_t_18, __pyx_t_15); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 295, __pyx_L1_error)
8627  __Pyx_GOTREF(__pyx_t_22);
8628  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
8629  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
8630  __pyx_t_15 = __Pyx_PyFloat_AddObjC(__pyx_t_22, __pyx_float_1_0eneg_20, 1.0e-20, 0, 0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 295, __pyx_L1_error)
8631  __Pyx_GOTREF(__pyx_t_15);
8632  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
8633  __pyx_t_23 = __pyx_PyFloat_AsDouble(__pyx_t_15); if (unlikely((__pyx_t_23 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 295, __pyx_L1_error)
8634  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
8635  __pyx_v_denom = __pyx_t_23;
8636 
8637  /* "subsurfaceTransportFunctions.pyx":296
8638  * numer = 2.0*material_functions[material_left](x[ebN,k],t)[I,J]*material_functions[material_right](x[ebN,k],t)[I,J]
8639  * denom = material_functions[material_left](x[ebN,k],t)[I,J] + material_functions[material_right](x[ebN,k],t)[I,J] + 1.0e-20
8640  * ebq_global_vals[ebN,k,I*nd+J] = numer/denom # <<<<<<<<<<<<<<
8641  *
8642  *
8643  */
8644  if (unlikely(__pyx_v_denom == 0)) {
8645  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
8646  __PYX_ERR(0, 296, __pyx_L1_error)
8647  }
8648  __pyx_t_4 = __pyx_v_ebN;
8649  __pyx_t_5 = __pyx_v_k;
8650  __pyx_t_24 = ((__pyx_v_I * __pyx_v_nd) + __pyx_v_J);
8651  __pyx_t_20 = -1;
8652  if (__pyx_t_4 < 0) {
8653  __pyx_t_4 += __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape;
8654  if (unlikely(__pyx_t_4 < 0)) __pyx_t_20 = 0;
8655  } else if (unlikely(__pyx_t_4 >= __pyx_pybuffernd_ebq_global_vals.diminfo[0].shape)) __pyx_t_20 = 0;
8656  if (__pyx_t_5 < 0) {
8657  __pyx_t_5 += __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape;
8658  if (unlikely(__pyx_t_5 < 0)) __pyx_t_20 = 1;
8659  } else if (unlikely(__pyx_t_5 >= __pyx_pybuffernd_ebq_global_vals.diminfo[1].shape)) __pyx_t_20 = 1;
8660  if (__pyx_t_24 < 0) {
8661  __pyx_t_24 += __pyx_pybuffernd_ebq_global_vals.diminfo[2].shape;
8662  if (unlikely(__pyx_t_24 < 0)) __pyx_t_20 = 2;
8663  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_ebq_global_vals.diminfo[2].shape)) __pyx_t_20 = 2;
8664  if (unlikely(__pyx_t_20 != -1)) {
8665  __Pyx_RaiseBufferIndexError(__pyx_t_20);
8666  __PYX_ERR(0, 296, __pyx_L1_error)
8667  }
8668  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_ebq_global_vals.diminfo[0].strides, __pyx_t_5, __pyx_pybuffernd_ebq_global_vals.diminfo[1].strides, __pyx_t_24, __pyx_pybuffernd_ebq_global_vals.diminfo[2].strides) = (__pyx_v_numer / __pyx_v_denom);
8669  }
8670  }
8671  }
8672  }
8673 
8674  /* "subsurfaceTransportFunctions.pyx":271
8675  *
8676  *
8677  * def evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
8678  * double t,
8679  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
8680  */
8681 
8682  /* function exit code */
8683  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8684  goto __pyx_L0;
8685  __pyx_L1_error:;
8686  __Pyx_XDECREF(__pyx_t_15);
8687  __Pyx_XDECREF(__pyx_t_16);
8688  __Pyx_XDECREF(__pyx_t_17);
8689  __Pyx_XDECREF(__pyx_t_18);
8690  __Pyx_XDECREF(__pyx_t_19);
8691  __Pyx_XDECREF(__pyx_t_21);
8692  __Pyx_XDECREF(__pyx_t_22);
8693  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
8694  __Pyx_PyThreadState_declare
8695  __Pyx_PyThreadState_assign
8696  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
8697  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
8698  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
8699  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
8700  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
8701  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
8702  __Pyx_AddTraceback("subsurfaceTransportFunctions.evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage", __pyx_clineno, __pyx_lineno, __pyx_filename);
8703  __pyx_r = NULL;
8704  goto __pyx_L2;
8705  __pyx_L0:;
8706  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ebq_global_vals.rcbuffer->pybuffer);
8707  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundariesArray.rcbuffer->pybuffer);
8708  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBoundaryTypes.rcbuffer->pybuffer);
8709  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
8710  __pyx_L2:;
8711  __Pyx_XGIVEREF(__pyx_r);
8712  __Pyx_RefNannyFinishContext();
8713  return __pyx_r;
8714 }
8715 
8716 /* "subsurfaceTransportFunctions.pyx":301
8717  *
8718  * ##################################################
8719  * def RE_NCP1_evaluateElementCoefficients_Linear(double rho, # <<<<<<<<<<<<<<
8720  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
8721  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
8722  */
8723 
8724 /* Python wrapper */
8725 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_29RE_NCP1_evaluateElementCoefficients_Linear(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
8726 static char __pyx_doc_28subsurfaceTransportFunctions_28RE_NCP1_evaluateElementCoefficients_Linear[] = "\n routine for evaluating linaer interface (nodal) coefficients in NCP1 approximation for Darcy Flow\n\n Approximation:\n uses nodal quadrature where the nodes are face barycenters\n uses harmonic average for intrinsic permeability/ hydraulic conductivity\n assumes slight compressiblity for now\n\n TODO:\n everything\n \n ";
8727 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_29RE_NCP1_evaluateElementCoefficients_Linear = {"RE_NCP1_evaluateElementCoefficients_Linear", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_29RE_NCP1_evaluateElementCoefficients_Linear, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_28RE_NCP1_evaluateElementCoefficients_Linear};
8728 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_29RE_NCP1_evaluateElementCoefficients_Linear(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8729  double __pyx_v_rho;
8730  PyArrayObject *__pyx_v_gravity = 0;
8731  PyArrayObject *__pyx_v_rowptr = 0;
8732  PyArrayObject *__pyx_v_colind = 0;
8733  PyArrayObject *__pyx_v_KWs = 0;
8734  int __pyx_v_nSpace;
8735  int __pyx_v_nElements_global;
8736  int __pyx_v_nElementBoundaries_element;
8737  PyArrayObject *__pyx_v_elementNeighborsArray = 0;
8738  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
8739  PyArrayObject *__pyx_v_q_flin = 0;
8740  PyArrayObject *__pyx_v_q_alin = 0;
8741  int __pyx_lineno = 0;
8742  const char *__pyx_filename = NULL;
8743  int __pyx_clineno = 0;
8744  PyObject *__pyx_r = 0;
8745  __Pyx_RefNannyDeclarations
8746  __Pyx_RefNannySetupContext("RE_NCP1_evaluateElementCoefficients_Linear (wrapper)", 0);
8747  {
8748  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rho,&__pyx_n_s_gravity,&__pyx_n_s_rowptr,&__pyx_n_s_colind,&__pyx_n_s_KWs,&__pyx_n_s_nSpace,&__pyx_n_s_nElements_global,&__pyx_n_s_nElementBoundaries_element,&__pyx_n_s_elementNeighborsArray,&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_q_flin,&__pyx_n_s_q_alin,0};
8749  PyObject* values[12] = {0,0,0,0,0,0,0,0,0,0,0,0};
8750  if (unlikely(__pyx_kwds)) {
8751  Py_ssize_t kw_args;
8752  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8753  switch (pos_args) {
8754  case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
8755  CYTHON_FALLTHROUGH;
8756  case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
8757  CYTHON_FALLTHROUGH;
8758  case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
8759  CYTHON_FALLTHROUGH;
8760  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
8761  CYTHON_FALLTHROUGH;
8762  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
8763  CYTHON_FALLTHROUGH;
8764  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
8765  CYTHON_FALLTHROUGH;
8766  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
8767  CYTHON_FALLTHROUGH;
8768  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
8769  CYTHON_FALLTHROUGH;
8770  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8771  CYTHON_FALLTHROUGH;
8772  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8773  CYTHON_FALLTHROUGH;
8774  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8775  CYTHON_FALLTHROUGH;
8776  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8777  CYTHON_FALLTHROUGH;
8778  case 0: break;
8779  default: goto __pyx_L5_argtuple_error;
8780  }
8781  kw_args = PyDict_Size(__pyx_kwds);
8782  switch (pos_args) {
8783  case 0:
8784  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rho)) != 0)) kw_args--;
8785  else goto __pyx_L5_argtuple_error;
8786  CYTHON_FALLTHROUGH;
8787  case 1:
8788  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gravity)) != 0)) kw_args--;
8789  else {
8790  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 1); __PYX_ERR(0, 301, __pyx_L3_error)
8791  }
8792  CYTHON_FALLTHROUGH;
8793  case 2:
8794  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rowptr)) != 0)) kw_args--;
8795  else {
8796  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 2); __PYX_ERR(0, 301, __pyx_L3_error)
8797  }
8798  CYTHON_FALLTHROUGH;
8799  case 3:
8800  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_colind)) != 0)) kw_args--;
8801  else {
8802  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 3); __PYX_ERR(0, 301, __pyx_L3_error)
8803  }
8804  CYTHON_FALLTHROUGH;
8805  case 4:
8806  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_KWs)) != 0)) kw_args--;
8807  else {
8808  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 4); __PYX_ERR(0, 301, __pyx_L3_error)
8809  }
8810  CYTHON_FALLTHROUGH;
8811  case 5:
8812  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nSpace)) != 0)) kw_args--;
8813  else {
8814  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 5); __PYX_ERR(0, 301, __pyx_L3_error)
8815  }
8816  CYTHON_FALLTHROUGH;
8817  case 6:
8818  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElements_global)) != 0)) kw_args--;
8819  else {
8820  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 6); __PYX_ERR(0, 301, __pyx_L3_error)
8821  }
8822  CYTHON_FALLTHROUGH;
8823  case 7:
8824  if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElementBoundaries_element)) != 0)) kw_args--;
8825  else {
8826  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 7); __PYX_ERR(0, 301, __pyx_L3_error)
8827  }
8828  CYTHON_FALLTHROUGH;
8829  case 8:
8830  if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementNeighborsArray)) != 0)) kw_args--;
8831  else {
8832  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 8); __PYX_ERR(0, 301, __pyx_L3_error)
8833  }
8834  CYTHON_FALLTHROUGH;
8835  case 9:
8836  if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
8837  else {
8838  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 9); __PYX_ERR(0, 301, __pyx_L3_error)
8839  }
8840  CYTHON_FALLTHROUGH;
8841  case 10:
8842  if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_flin)) != 0)) kw_args--;
8843  else {
8844  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 10); __PYX_ERR(0, 301, __pyx_L3_error)
8845  }
8846  CYTHON_FALLTHROUGH;
8847  case 11:
8848  if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_alin)) != 0)) kw_args--;
8849  else {
8850  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, 11); __PYX_ERR(0, 301, __pyx_L3_error)
8851  }
8852  }
8853  if (unlikely(kw_args > 0)) {
8854  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "RE_NCP1_evaluateElementCoefficients_Linear") < 0)) __PYX_ERR(0, 301, __pyx_L3_error)
8855  }
8856  } else if (PyTuple_GET_SIZE(__pyx_args) != 12) {
8857  goto __pyx_L5_argtuple_error;
8858  } else {
8859  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8860  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8861  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8862  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8863  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
8864  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
8865  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
8866  values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
8867  values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
8868  values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
8869  values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
8870  values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
8871  }
8872  __pyx_v_rho = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_rho == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 301, __pyx_L3_error)
8873  __pyx_v_gravity = ((PyArrayObject *)values[1]);
8874  __pyx_v_rowptr = ((PyArrayObject *)values[2]);
8875  __pyx_v_colind = ((PyArrayObject *)values[3]);
8876  __pyx_v_KWs = ((PyArrayObject *)values[4]);
8877  __pyx_v_nSpace = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_nSpace == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 307, __pyx_L3_error)
8878  __pyx_v_nElements_global = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_nElements_global == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 308, __pyx_L3_error)
8879  __pyx_v_nElementBoundaries_element = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_nElementBoundaries_element == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 309, __pyx_L3_error)
8880  __pyx_v_elementNeighborsArray = ((PyArrayObject *)values[8]);
8881  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[9]);
8882  __pyx_v_q_flin = ((PyArrayObject *)values[10]);
8883  __pyx_v_q_alin = ((PyArrayObject *)values[11]);
8884  }
8885  goto __pyx_L4_argument_unpacking_done;
8886  __pyx_L5_argtuple_error:;
8887  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_Linear", 1, 12, 12, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 301, __pyx_L3_error)
8888  __pyx_L3_error:;
8889  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_evaluateElementCoefficients_Linear", __pyx_clineno, __pyx_lineno, __pyx_filename);
8890  __Pyx_RefNannyFinishContext();
8891  return NULL;
8892  __pyx_L4_argument_unpacking_done:;
8893  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gravity), __pyx_ptype_5numpy_ndarray, 1, "gravity", 0))) __PYX_ERR(0, 302, __pyx_L1_error)
8894  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rowptr), __pyx_ptype_5numpy_ndarray, 1, "rowptr", 0))) __PYX_ERR(0, 303, __pyx_L1_error)
8895  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_colind), __pyx_ptype_5numpy_ndarray, 1, "colind", 0))) __PYX_ERR(0, 304, __pyx_L1_error)
8896  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_KWs), __pyx_ptype_5numpy_ndarray, 1, "KWs", 0))) __PYX_ERR(0, 305, __pyx_L1_error)
8897  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementNeighborsArray), __pyx_ptype_5numpy_ndarray, 1, "elementNeighborsArray", 0))) __PYX_ERR(0, 310, __pyx_L1_error)
8898  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) __PYX_ERR(0, 311, __pyx_L1_error)
8899  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_flin), __pyx_ptype_5numpy_ndarray, 1, "q_flin", 0))) __PYX_ERR(0, 312, __pyx_L1_error)
8900  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_alin), __pyx_ptype_5numpy_ndarray, 1, "q_alin", 0))) __PYX_ERR(0, 313, __pyx_L1_error)
8901  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_28RE_NCP1_evaluateElementCoefficients_Linear(__pyx_self, __pyx_v_rho, __pyx_v_gravity, __pyx_v_rowptr, __pyx_v_colind, __pyx_v_KWs, __pyx_v_nSpace, __pyx_v_nElements_global, __pyx_v_nElementBoundaries_element, __pyx_v_elementNeighborsArray, __pyx_v_elementMaterialTypes, __pyx_v_q_flin, __pyx_v_q_alin);
8902 
8903  /* function exit code */
8904  goto __pyx_L0;
8905  __pyx_L1_error:;
8906  __pyx_r = NULL;
8907  __pyx_L0:;
8908  __Pyx_RefNannyFinishContext();
8909  return __pyx_r;
8910 }
8911 
8912 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_28RE_NCP1_evaluateElementCoefficients_Linear(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_rho, PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_rowptr, PyArrayObject *__pyx_v_colind, PyArrayObject *__pyx_v_KWs, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, PyArrayObject *__pyx_v_elementNeighborsArray, PyArrayObject *__pyx_v_elementMaterialTypes, PyArrayObject *__pyx_v_q_flin, PyArrayObject *__pyx_v_q_alin) {
8913  int __pyx_v_eN;
8914  int __pyx_v_eN_neighbor;
8915  int __pyx_v_ii;
8916  int __pyx_v_I;
8917  int __pyx_v_ebN;
8918  int __pyx_v_matID;
8919  int __pyx_v_matID_neig;
8920  CYTHON_UNUSED int __pyx_v_nSpace2;
8921  int __pyx_v_nnz;
8922  PyArrayObject *__pyx_v_a_eN = 0;
8923  PyArrayObject *__pyx_v_a_neig = 0;
8924  PyArrayObject *__pyx_v_a_avg = 0;
8925  __Pyx_LocalBuf_ND __pyx_pybuffernd_KWs;
8926  __Pyx_Buffer __pyx_pybuffer_KWs;
8927  __Pyx_LocalBuf_ND __pyx_pybuffernd_a_avg;
8928  __Pyx_Buffer __pyx_pybuffer_a_avg;
8929  __Pyx_LocalBuf_ND __pyx_pybuffernd_a_eN;
8930  __Pyx_Buffer __pyx_pybuffer_a_eN;
8931  __Pyx_LocalBuf_ND __pyx_pybuffernd_a_neig;
8932  __Pyx_Buffer __pyx_pybuffer_a_neig;
8933  __Pyx_LocalBuf_ND __pyx_pybuffernd_colind;
8934  __Pyx_Buffer __pyx_pybuffer_colind;
8935  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
8936  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
8937  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementNeighborsArray;
8938  __Pyx_Buffer __pyx_pybuffer_elementNeighborsArray;
8939  __Pyx_LocalBuf_ND __pyx_pybuffernd_gravity;
8940  __Pyx_Buffer __pyx_pybuffer_gravity;
8941  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_alin;
8942  __Pyx_Buffer __pyx_pybuffer_q_alin;
8943  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_flin;
8944  __Pyx_Buffer __pyx_pybuffer_q_flin;
8945  __Pyx_LocalBuf_ND __pyx_pybuffernd_rowptr;
8946  __Pyx_Buffer __pyx_pybuffer_rowptr;
8947  PyObject *__pyx_r = NULL;
8948  __Pyx_RefNannyDeclarations
8949  Py_ssize_t __pyx_t_1;
8950  int __pyx_t_2;
8951  PyObject *__pyx_t_3 = NULL;
8952  PyObject *__pyx_t_4 = NULL;
8953  PyObject *__pyx_t_5 = NULL;
8954  PyObject *__pyx_t_6 = NULL;
8955  PyObject *__pyx_t_7 = NULL;
8956  PyArrayObject *__pyx_t_8 = NULL;
8957  PyArrayObject *__pyx_t_9 = NULL;
8958  PyArrayObject *__pyx_t_10 = NULL;
8959  int __pyx_t_11;
8960  int __pyx_t_12;
8961  int __pyx_t_13;
8962  int __pyx_t_14;
8963  int __pyx_t_15;
8964  Py_ssize_t __pyx_t_16;
8965  int __pyx_t_17;
8966  Py_ssize_t __pyx_t_18;
8967  int __pyx_t_19;
8968  int __pyx_t_20;
8969  int __pyx_t_21;
8970  int __pyx_t_22;
8971  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_23;
8972  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_24;
8973  Py_ssize_t __pyx_t_25;
8974  __pyx_t_28subsurfaceTransportFunctions_ITYPE_t __pyx_t_26;
8975  __pyx_t_28subsurfaceTransportFunctions_ITYPE_t __pyx_t_27;
8976  int __pyx_t_28;
8977  Py_ssize_t __pyx_t_29;
8978  Py_ssize_t __pyx_t_30;
8979  Py_ssize_t __pyx_t_31;
8980  int __pyx_lineno = 0;
8981  const char *__pyx_filename = NULL;
8982  int __pyx_clineno = 0;
8983  __Pyx_RefNannySetupContext("RE_NCP1_evaluateElementCoefficients_Linear", 0);
8984  __pyx_pybuffer_a_eN.pybuffer.buf = NULL;
8985  __pyx_pybuffer_a_eN.refcount = 0;
8986  __pyx_pybuffernd_a_eN.data = NULL;
8987  __pyx_pybuffernd_a_eN.rcbuffer = &__pyx_pybuffer_a_eN;
8988  __pyx_pybuffer_a_neig.pybuffer.buf = NULL;
8989  __pyx_pybuffer_a_neig.refcount = 0;
8990  __pyx_pybuffernd_a_neig.data = NULL;
8991  __pyx_pybuffernd_a_neig.rcbuffer = &__pyx_pybuffer_a_neig;
8992  __pyx_pybuffer_a_avg.pybuffer.buf = NULL;
8993  __pyx_pybuffer_a_avg.refcount = 0;
8994  __pyx_pybuffernd_a_avg.data = NULL;
8995  __pyx_pybuffernd_a_avg.rcbuffer = &__pyx_pybuffer_a_avg;
8996  __pyx_pybuffer_gravity.pybuffer.buf = NULL;
8997  __pyx_pybuffer_gravity.refcount = 0;
8998  __pyx_pybuffernd_gravity.data = NULL;
8999  __pyx_pybuffernd_gravity.rcbuffer = &__pyx_pybuffer_gravity;
9000  __pyx_pybuffer_rowptr.pybuffer.buf = NULL;
9001  __pyx_pybuffer_rowptr.refcount = 0;
9002  __pyx_pybuffernd_rowptr.data = NULL;
9003  __pyx_pybuffernd_rowptr.rcbuffer = &__pyx_pybuffer_rowptr;
9004  __pyx_pybuffer_colind.pybuffer.buf = NULL;
9005  __pyx_pybuffer_colind.refcount = 0;
9006  __pyx_pybuffernd_colind.data = NULL;
9007  __pyx_pybuffernd_colind.rcbuffer = &__pyx_pybuffer_colind;
9008  __pyx_pybuffer_KWs.pybuffer.buf = NULL;
9009  __pyx_pybuffer_KWs.refcount = 0;
9010  __pyx_pybuffernd_KWs.data = NULL;
9011  __pyx_pybuffernd_KWs.rcbuffer = &__pyx_pybuffer_KWs;
9012  __pyx_pybuffer_elementNeighborsArray.pybuffer.buf = NULL;
9013  __pyx_pybuffer_elementNeighborsArray.refcount = 0;
9014  __pyx_pybuffernd_elementNeighborsArray.data = NULL;
9015  __pyx_pybuffernd_elementNeighborsArray.rcbuffer = &__pyx_pybuffer_elementNeighborsArray;
9016  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
9017  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
9018  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
9019  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
9020  __pyx_pybuffer_q_flin.pybuffer.buf = NULL;
9021  __pyx_pybuffer_q_flin.refcount = 0;
9022  __pyx_pybuffernd_q_flin.data = NULL;
9023  __pyx_pybuffernd_q_flin.rcbuffer = &__pyx_pybuffer_q_flin;
9024  __pyx_pybuffer_q_alin.pybuffer.buf = NULL;
9025  __pyx_pybuffer_q_alin.refcount = 0;
9026  __pyx_pybuffernd_q_alin.data = NULL;
9027  __pyx_pybuffernd_q_alin.rcbuffer = &__pyx_pybuffer_q_alin;
9028  {
9029  __Pyx_BufFmt_StackElem __pyx_stack[1];
9030  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer, (PyObject*)__pyx_v_gravity, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
9031  }
9032  __pyx_pybuffernd_gravity.diminfo[0].strides = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_gravity.diminfo[0].shape = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.shape[0];
9033  {
9034  __Pyx_BufFmt_StackElem __pyx_stack[1];
9035  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer, (PyObject*)__pyx_v_rowptr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
9036  }
9037  __pyx_pybuffernd_rowptr.diminfo[0].strides = __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_rowptr.diminfo[0].shape = __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.shape[0];
9038  {
9039  __Pyx_BufFmt_StackElem __pyx_stack[1];
9040  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_colind.rcbuffer->pybuffer, (PyObject*)__pyx_v_colind, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
9041  }
9042  __pyx_pybuffernd_colind.diminfo[0].strides = __pyx_pybuffernd_colind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_colind.diminfo[0].shape = __pyx_pybuffernd_colind.rcbuffer->pybuffer.shape[0];
9043  {
9044  __Pyx_BufFmt_StackElem __pyx_stack[1];
9045  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_KWs.rcbuffer->pybuffer, (PyObject*)__pyx_v_KWs, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
9046  }
9047  __pyx_pybuffernd_KWs.diminfo[0].strides = __pyx_pybuffernd_KWs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_KWs.diminfo[0].shape = __pyx_pybuffernd_KWs.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_KWs.diminfo[1].strides = __pyx_pybuffernd_KWs.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_KWs.diminfo[1].shape = __pyx_pybuffernd_KWs.rcbuffer->pybuffer.shape[1];
9048  {
9049  __Pyx_BufFmt_StackElem __pyx_stack[1];
9050  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementNeighborsArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
9051  }
9052  __pyx_pybuffernd_elementNeighborsArray.diminfo[0].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[1];
9053  {
9054  __Pyx_BufFmt_StackElem __pyx_stack[1];
9055  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
9056  }
9057  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
9058  {
9059  __Pyx_BufFmt_StackElem __pyx_stack[1];
9060  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_flin, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
9061  }
9062  __pyx_pybuffernd_q_flin.diminfo[0].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_flin.diminfo[0].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_flin.diminfo[1].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_flin.diminfo[1].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_flin.diminfo[2].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_flin.diminfo[2].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[2];
9063  {
9064  __Pyx_BufFmt_StackElem __pyx_stack[1];
9065  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_alin, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 301, __pyx_L1_error)
9066  }
9067  __pyx_pybuffernd_q_alin.diminfo[0].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_alin.diminfo[0].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_alin.diminfo[1].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_alin.diminfo[1].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_alin.diminfo[2].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_alin.diminfo[2].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[2];
9068 
9069  /* "subsurfaceTransportFunctions.pyx":328
9070  * #temporaries
9071  * cdef int eN,eN_neighbor,ii,I,ebN,matID,matID_neig
9072  * cdef int nSpace2 = nSpace*nSpace # <<<<<<<<<<<<<<
9073  * cdef int nnz = rowptr[nSpace]
9074  *
9075  */
9076  __pyx_v_nSpace2 = (__pyx_v_nSpace * __pyx_v_nSpace);
9077 
9078  /* "subsurfaceTransportFunctions.pyx":329
9079  * cdef int eN,eN_neighbor,ii,I,ebN,matID,matID_neig
9080  * cdef int nSpace2 = nSpace*nSpace
9081  * cdef int nnz = rowptr[nSpace] # <<<<<<<<<<<<<<
9082  *
9083  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_eN = numpy.zeros(nnz,'d')
9084  */
9085  __pyx_t_1 = __pyx_v_nSpace;
9086  __pyx_t_2 = -1;
9087  if (__pyx_t_1 < 0) {
9088  __pyx_t_1 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
9089  if (unlikely(__pyx_t_1 < 0)) __pyx_t_2 = 0;
9090  } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_2 = 0;
9091  if (unlikely(__pyx_t_2 != -1)) {
9092  __Pyx_RaiseBufferIndexError(__pyx_t_2);
9093  __PYX_ERR(0, 329, __pyx_L1_error)
9094  }
9095  __pyx_v_nnz = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_rowptr.diminfo[0].strides));
9096 
9097  /* "subsurfaceTransportFunctions.pyx":331
9098  * cdef int nnz = rowptr[nSpace]
9099  *
9100  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_eN = numpy.zeros(nnz,'d') # <<<<<<<<<<<<<<
9101  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_neig = numpy.zeros(nnz,'d')
9102  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_avg = numpy.zeros(nnz,'d')
9103  */
9104  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 331, __pyx_L1_error)
9105  __Pyx_GOTREF(__pyx_t_4);
9106  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 331, __pyx_L1_error)
9107  __Pyx_GOTREF(__pyx_t_5);
9108  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9109  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_nnz); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 331, __pyx_L1_error)
9110  __Pyx_GOTREF(__pyx_t_4);
9111  __pyx_t_6 = NULL;
9112  __pyx_t_2 = 0;
9113  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
9114  __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
9115  if (likely(__pyx_t_6)) {
9116  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
9117  __Pyx_INCREF(__pyx_t_6);
9118  __Pyx_INCREF(function);
9119  __Pyx_DECREF_SET(__pyx_t_5, function);
9120  __pyx_t_2 = 1;
9121  }
9122  }
9123  #if CYTHON_FAST_PYCALL
9124  if (PyFunction_Check(__pyx_t_5)) {
9125  PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_n_s_d};
9126  __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 331, __pyx_L1_error)
9127  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
9128  __Pyx_GOTREF(__pyx_t_3);
9129  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9130  } else
9131  #endif
9132  #if CYTHON_FAST_PYCCALL
9133  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
9134  PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_n_s_d};
9135  __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 331, __pyx_L1_error)
9136  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
9137  __Pyx_GOTREF(__pyx_t_3);
9138  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9139  } else
9140  #endif
9141  {
9142  __pyx_t_7 = PyTuple_New(2+__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 331, __pyx_L1_error)
9143  __Pyx_GOTREF(__pyx_t_7);
9144  if (__pyx_t_6) {
9145  __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
9146  }
9147  __Pyx_GIVEREF(__pyx_t_4);
9148  PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_2, __pyx_t_4);
9149  __Pyx_INCREF(__pyx_n_s_d);
9150  __Pyx_GIVEREF(__pyx_n_s_d);
9151  PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_2, __pyx_n_s_d);
9152  __pyx_t_4 = 0;
9153  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 331, __pyx_L1_error)
9154  __Pyx_GOTREF(__pyx_t_3);
9155  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9156  }
9157  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9158  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 331, __pyx_L1_error)
9159  __pyx_t_8 = ((PyArrayObject *)__pyx_t_3);
9160  {
9161  __Pyx_BufFmt_StackElem __pyx_stack[1];
9162  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_a_eN.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
9163  __pyx_v_a_eN = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_a_eN.rcbuffer->pybuffer.buf = NULL;
9164  __PYX_ERR(0, 331, __pyx_L1_error)
9165  } else {__pyx_pybuffernd_a_eN.diminfo[0].strides = __pyx_pybuffernd_a_eN.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_a_eN.diminfo[0].shape = __pyx_pybuffernd_a_eN.rcbuffer->pybuffer.shape[0];
9166  }
9167  }
9168  __pyx_t_8 = 0;
9169  __pyx_v_a_eN = ((PyArrayObject *)__pyx_t_3);
9170  __pyx_t_3 = 0;
9171 
9172  /* "subsurfaceTransportFunctions.pyx":332
9173  *
9174  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_eN = numpy.zeros(nnz,'d')
9175  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_neig = numpy.zeros(nnz,'d') # <<<<<<<<<<<<<<
9176  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_avg = numpy.zeros(nnz,'d')
9177  *
9178  */
9179  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_numpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 332, __pyx_L1_error)
9180  __Pyx_GOTREF(__pyx_t_5);
9181  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 332, __pyx_L1_error)
9182  __Pyx_GOTREF(__pyx_t_7);
9183  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9184  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_nnz); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 332, __pyx_L1_error)
9185  __Pyx_GOTREF(__pyx_t_5);
9186  __pyx_t_4 = NULL;
9187  __pyx_t_2 = 0;
9188  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
9189  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
9190  if (likely(__pyx_t_4)) {
9191  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
9192  __Pyx_INCREF(__pyx_t_4);
9193  __Pyx_INCREF(function);
9194  __Pyx_DECREF_SET(__pyx_t_7, function);
9195  __pyx_t_2 = 1;
9196  }
9197  }
9198  #if CYTHON_FAST_PYCALL
9199  if (PyFunction_Check(__pyx_t_7)) {
9200  PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_n_s_d};
9201  __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 332, __pyx_L1_error)
9202  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
9203  __Pyx_GOTREF(__pyx_t_3);
9204  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9205  } else
9206  #endif
9207  #if CYTHON_FAST_PYCCALL
9208  if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
9209  PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_n_s_d};
9210  __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 332, __pyx_L1_error)
9211  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
9212  __Pyx_GOTREF(__pyx_t_3);
9213  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9214  } else
9215  #endif
9216  {
9217  __pyx_t_6 = PyTuple_New(2+__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 332, __pyx_L1_error)
9218  __Pyx_GOTREF(__pyx_t_6);
9219  if (__pyx_t_4) {
9220  __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
9221  }
9222  __Pyx_GIVEREF(__pyx_t_5);
9223  PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_2, __pyx_t_5);
9224  __Pyx_INCREF(__pyx_n_s_d);
9225  __Pyx_GIVEREF(__pyx_n_s_d);
9226  PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_2, __pyx_n_s_d);
9227  __pyx_t_5 = 0;
9228  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 332, __pyx_L1_error)
9229  __Pyx_GOTREF(__pyx_t_3);
9230  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9231  }
9232  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9233  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 332, __pyx_L1_error)
9234  __pyx_t_9 = ((PyArrayObject *)__pyx_t_3);
9235  {
9236  __Pyx_BufFmt_StackElem __pyx_stack[1];
9237  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_a_neig.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
9238  __pyx_v_a_neig = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_a_neig.rcbuffer->pybuffer.buf = NULL;
9239  __PYX_ERR(0, 332, __pyx_L1_error)
9240  } else {__pyx_pybuffernd_a_neig.diminfo[0].strides = __pyx_pybuffernd_a_neig.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_a_neig.diminfo[0].shape = __pyx_pybuffernd_a_neig.rcbuffer->pybuffer.shape[0];
9241  }
9242  }
9243  __pyx_t_9 = 0;
9244  __pyx_v_a_neig = ((PyArrayObject *)__pyx_t_3);
9245  __pyx_t_3 = 0;
9246 
9247  /* "subsurfaceTransportFunctions.pyx":333
9248  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_eN = numpy.zeros(nnz,'d')
9249  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_neig = numpy.zeros(nnz,'d')
9250  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_avg = numpy.zeros(nnz,'d') # <<<<<<<<<<<<<<
9251  *
9252  * #loop through and evaluate
9253  */
9254  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_numpy); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 333, __pyx_L1_error)
9255  __Pyx_GOTREF(__pyx_t_7);
9256  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 333, __pyx_L1_error)
9257  __Pyx_GOTREF(__pyx_t_6);
9258  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9259  __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_nnz); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 333, __pyx_L1_error)
9260  __Pyx_GOTREF(__pyx_t_7);
9261  __pyx_t_5 = NULL;
9262  __pyx_t_2 = 0;
9263  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
9264  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
9265  if (likely(__pyx_t_5)) {
9266  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
9267  __Pyx_INCREF(__pyx_t_5);
9268  __Pyx_INCREF(function);
9269  __Pyx_DECREF_SET(__pyx_t_6, function);
9270  __pyx_t_2 = 1;
9271  }
9272  }
9273  #if CYTHON_FAST_PYCALL
9274  if (PyFunction_Check(__pyx_t_6)) {
9275  PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_7, __pyx_n_s_d};
9276  __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error)
9277  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9278  __Pyx_GOTREF(__pyx_t_3);
9279  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9280  } else
9281  #endif
9282  #if CYTHON_FAST_PYCCALL
9283  if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
9284  PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_7, __pyx_n_s_d};
9285  __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_2, 2+__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error)
9286  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9287  __Pyx_GOTREF(__pyx_t_3);
9288  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
9289  } else
9290  #endif
9291  {
9292  __pyx_t_4 = PyTuple_New(2+__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 333, __pyx_L1_error)
9293  __Pyx_GOTREF(__pyx_t_4);
9294  if (__pyx_t_5) {
9295  __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL;
9296  }
9297  __Pyx_GIVEREF(__pyx_t_7);
9298  PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_2, __pyx_t_7);
9299  __Pyx_INCREF(__pyx_n_s_d);
9300  __Pyx_GIVEREF(__pyx_n_s_d);
9301  PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_2, __pyx_n_s_d);
9302  __pyx_t_7 = 0;
9303  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error)
9304  __Pyx_GOTREF(__pyx_t_3);
9305  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9306  }
9307  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9308  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 333, __pyx_L1_error)
9309  __pyx_t_10 = ((PyArrayObject *)__pyx_t_3);
9310  {
9311  __Pyx_BufFmt_StackElem __pyx_stack[1];
9312  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_a_avg.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
9313  __pyx_v_a_avg = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_a_avg.rcbuffer->pybuffer.buf = NULL;
9314  __PYX_ERR(0, 333, __pyx_L1_error)
9315  } else {__pyx_pybuffernd_a_avg.diminfo[0].strides = __pyx_pybuffernd_a_avg.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_a_avg.diminfo[0].shape = __pyx_pybuffernd_a_avg.rcbuffer->pybuffer.shape[0];
9316  }
9317  }
9318  __pyx_t_10 = 0;
9319  __pyx_v_a_avg = ((PyArrayObject *)__pyx_t_3);
9320  __pyx_t_3 = 0;
9321 
9322  /* "subsurfaceTransportFunctions.pyx":336
9323  *
9324  * #loop through and evaluate
9325  * for eN in range(nElements_global): # <<<<<<<<<<<<<<
9326  * matID = elementMaterialTypes[eN]
9327  * for ii in range(nnz):
9328  */
9329  __pyx_t_2 = __pyx_v_nElements_global;
9330  __pyx_t_11 = __pyx_t_2;
9331  for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
9332  __pyx_v_eN = __pyx_t_12;
9333 
9334  /* "subsurfaceTransportFunctions.pyx":337
9335  * #loop through and evaluate
9336  * for eN in range(nElements_global):
9337  * matID = elementMaterialTypes[eN] # <<<<<<<<<<<<<<
9338  * for ii in range(nnz):
9339  * a_eN[ii] = rho*KWs[matID,ii]
9340  */
9341  __pyx_t_1 = __pyx_v_eN;
9342  __pyx_t_13 = -1;
9343  if (__pyx_t_1 < 0) {
9344  __pyx_t_1 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
9345  if (unlikely(__pyx_t_1 < 0)) __pyx_t_13 = 0;
9346  } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_13 = 0;
9347  if (unlikely(__pyx_t_13 != -1)) {
9348  __Pyx_RaiseBufferIndexError(__pyx_t_13);
9349  __PYX_ERR(0, 337, __pyx_L1_error)
9350  }
9351  __pyx_v_matID = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
9352 
9353  /* "subsurfaceTransportFunctions.pyx":338
9354  * for eN in range(nElements_global):
9355  * matID = elementMaterialTypes[eN]
9356  * for ii in range(nnz): # <<<<<<<<<<<<<<
9357  * a_eN[ii] = rho*KWs[matID,ii]
9358  * for ebN in range(nElementBoundaries_element):
9359  */
9360  __pyx_t_13 = __pyx_v_nnz;
9361  __pyx_t_14 = __pyx_t_13;
9362  for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
9363  __pyx_v_ii = __pyx_t_15;
9364 
9365  /* "subsurfaceTransportFunctions.pyx":339
9366  * matID = elementMaterialTypes[eN]
9367  * for ii in range(nnz):
9368  * a_eN[ii] = rho*KWs[matID,ii] # <<<<<<<<<<<<<<
9369  * for ebN in range(nElementBoundaries_element):
9370  * eN_neighbor = elementNeighborsArray[eN,ebN]
9371  */
9372  __pyx_t_1 = __pyx_v_matID;
9373  __pyx_t_16 = __pyx_v_ii;
9374  __pyx_t_17 = -1;
9375  if (__pyx_t_1 < 0) {
9376  __pyx_t_1 += __pyx_pybuffernd_KWs.diminfo[0].shape;
9377  if (unlikely(__pyx_t_1 < 0)) __pyx_t_17 = 0;
9378  } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_KWs.diminfo[0].shape)) __pyx_t_17 = 0;
9379  if (__pyx_t_16 < 0) {
9380  __pyx_t_16 += __pyx_pybuffernd_KWs.diminfo[1].shape;
9381  if (unlikely(__pyx_t_16 < 0)) __pyx_t_17 = 1;
9382  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_KWs.diminfo[1].shape)) __pyx_t_17 = 1;
9383  if (unlikely(__pyx_t_17 != -1)) {
9384  __Pyx_RaiseBufferIndexError(__pyx_t_17);
9385  __PYX_ERR(0, 339, __pyx_L1_error)
9386  }
9387  __pyx_t_18 = __pyx_v_ii;
9388  __pyx_t_17 = -1;
9389  if (__pyx_t_18 < 0) {
9390  __pyx_t_18 += __pyx_pybuffernd_a_eN.diminfo[0].shape;
9391  if (unlikely(__pyx_t_18 < 0)) __pyx_t_17 = 0;
9392  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_a_eN.diminfo[0].shape)) __pyx_t_17 = 0;
9393  if (unlikely(__pyx_t_17 != -1)) {
9394  __Pyx_RaiseBufferIndexError(__pyx_t_17);
9395  __PYX_ERR(0, 339, __pyx_L1_error)
9396  }
9397  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_eN.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_a_eN.diminfo[0].strides) = (__pyx_v_rho * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_KWs.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_KWs.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_KWs.diminfo[1].strides)));
9398  }
9399 
9400  /* "subsurfaceTransportFunctions.pyx":340
9401  * for ii in range(nnz):
9402  * a_eN[ii] = rho*KWs[matID,ii]
9403  * for ebN in range(nElementBoundaries_element): # <<<<<<<<<<<<<<
9404  * eN_neighbor = elementNeighborsArray[eN,ebN]
9405  * for ii in range(nnz):
9406  */
9407  __pyx_t_13 = __pyx_v_nElementBoundaries_element;
9408  __pyx_t_14 = __pyx_t_13;
9409  for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
9410  __pyx_v_ebN = __pyx_t_15;
9411 
9412  /* "subsurfaceTransportFunctions.pyx":341
9413  * a_eN[ii] = rho*KWs[matID,ii]
9414  * for ebN in range(nElementBoundaries_element):
9415  * eN_neighbor = elementNeighborsArray[eN,ebN] # <<<<<<<<<<<<<<
9416  * for ii in range(nnz):
9417  * a_neig[ii] = a_eN[ii]
9418  */
9419  __pyx_t_16 = __pyx_v_eN;
9420  __pyx_t_1 = __pyx_v_ebN;
9421  __pyx_t_17 = -1;
9422  if (__pyx_t_16 < 0) {
9423  __pyx_t_16 += __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape;
9424  if (unlikely(__pyx_t_16 < 0)) __pyx_t_17 = 0;
9425  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape)) __pyx_t_17 = 0;
9426  if (__pyx_t_1 < 0) {
9427  __pyx_t_1 += __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape;
9428  if (unlikely(__pyx_t_1 < 0)) __pyx_t_17 = 1;
9429  } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape)) __pyx_t_17 = 1;
9430  if (unlikely(__pyx_t_17 != -1)) {
9431  __Pyx_RaiseBufferIndexError(__pyx_t_17);
9432  __PYX_ERR(0, 341, __pyx_L1_error)
9433  }
9434  __pyx_v_eN_neighbor = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_elementNeighborsArray.diminfo[0].strides, __pyx_t_1, __pyx_pybuffernd_elementNeighborsArray.diminfo[1].strides));
9435 
9436  /* "subsurfaceTransportFunctions.pyx":342
9437  * for ebN in range(nElementBoundaries_element):
9438  * eN_neighbor = elementNeighborsArray[eN,ebN]
9439  * for ii in range(nnz): # <<<<<<<<<<<<<<
9440  * a_neig[ii] = a_eN[ii]
9441  * if eN_neighbor >= 0:
9442  */
9443  __pyx_t_17 = __pyx_v_nnz;
9444  __pyx_t_19 = __pyx_t_17;
9445  for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
9446  __pyx_v_ii = __pyx_t_20;
9447 
9448  /* "subsurfaceTransportFunctions.pyx":343
9449  * eN_neighbor = elementNeighborsArray[eN,ebN]
9450  * for ii in range(nnz):
9451  * a_neig[ii] = a_eN[ii] # <<<<<<<<<<<<<<
9452  * if eN_neighbor >= 0:
9453  * matID_neig = elementMaterialTypes[eN_neighbor]
9454  */
9455  __pyx_t_1 = __pyx_v_ii;
9456  __pyx_t_21 = -1;
9457  if (__pyx_t_1 < 0) {
9458  __pyx_t_1 += __pyx_pybuffernd_a_eN.diminfo[0].shape;
9459  if (unlikely(__pyx_t_1 < 0)) __pyx_t_21 = 0;
9460  } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_a_eN.diminfo[0].shape)) __pyx_t_21 = 0;
9461  if (unlikely(__pyx_t_21 != -1)) {
9462  __Pyx_RaiseBufferIndexError(__pyx_t_21);
9463  __PYX_ERR(0, 343, __pyx_L1_error)
9464  }
9465  __pyx_t_16 = __pyx_v_ii;
9466  __pyx_t_21 = -1;
9467  if (__pyx_t_16 < 0) {
9468  __pyx_t_16 += __pyx_pybuffernd_a_neig.diminfo[0].shape;
9469  if (unlikely(__pyx_t_16 < 0)) __pyx_t_21 = 0;
9470  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_a_neig.diminfo[0].shape)) __pyx_t_21 = 0;
9471  if (unlikely(__pyx_t_21 != -1)) {
9472  __Pyx_RaiseBufferIndexError(__pyx_t_21);
9473  __PYX_ERR(0, 343, __pyx_L1_error)
9474  }
9475  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_neig.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_a_neig.diminfo[0].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_eN.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_a_eN.diminfo[0].strides));
9476  }
9477 
9478  /* "subsurfaceTransportFunctions.pyx":344
9479  * for ii in range(nnz):
9480  * a_neig[ii] = a_eN[ii]
9481  * if eN_neighbor >= 0: # <<<<<<<<<<<<<<
9482  * matID_neig = elementMaterialTypes[eN_neighbor]
9483  * for ii in range(nnz):
9484  */
9485  __pyx_t_22 = ((__pyx_v_eN_neighbor >= 0) != 0);
9486  if (__pyx_t_22) {
9487 
9488  /* "subsurfaceTransportFunctions.pyx":345
9489  * a_neig[ii] = a_eN[ii]
9490  * if eN_neighbor >= 0:
9491  * matID_neig = elementMaterialTypes[eN_neighbor] # <<<<<<<<<<<<<<
9492  * for ii in range(nnz):
9493  * a_neig[ii] = rho*KWs[matID_neig,ii]
9494  */
9495  __pyx_t_1 = __pyx_v_eN_neighbor;
9496  __pyx_t_17 = -1;
9497  if (__pyx_t_1 < 0) {
9498  __pyx_t_1 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
9499  if (unlikely(__pyx_t_1 < 0)) __pyx_t_17 = 0;
9500  } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_17 = 0;
9501  if (unlikely(__pyx_t_17 != -1)) {
9502  __Pyx_RaiseBufferIndexError(__pyx_t_17);
9503  __PYX_ERR(0, 345, __pyx_L1_error)
9504  }
9505  __pyx_v_matID_neig = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
9506 
9507  /* "subsurfaceTransportFunctions.pyx":346
9508  * if eN_neighbor >= 0:
9509  * matID_neig = elementMaterialTypes[eN_neighbor]
9510  * for ii in range(nnz): # <<<<<<<<<<<<<<
9511  * a_neig[ii] = rho*KWs[matID_neig,ii]
9512  * for ii in range(nnz):
9513  */
9514  __pyx_t_17 = __pyx_v_nnz;
9515  __pyx_t_19 = __pyx_t_17;
9516  for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
9517  __pyx_v_ii = __pyx_t_20;
9518 
9519  /* "subsurfaceTransportFunctions.pyx":347
9520  * matID_neig = elementMaterialTypes[eN_neighbor]
9521  * for ii in range(nnz):
9522  * a_neig[ii] = rho*KWs[matID_neig,ii] # <<<<<<<<<<<<<<
9523  * for ii in range(nnz):
9524  * a_avg[ii] = 2.0*a_eN[ii]*a_neig[ii]/(a_eN[ii]+a_neig[ii]+1.0e-20)
9525  */
9526  __pyx_t_1 = __pyx_v_matID_neig;
9527  __pyx_t_16 = __pyx_v_ii;
9528  __pyx_t_21 = -1;
9529  if (__pyx_t_1 < 0) {
9530  __pyx_t_1 += __pyx_pybuffernd_KWs.diminfo[0].shape;
9531  if (unlikely(__pyx_t_1 < 0)) __pyx_t_21 = 0;
9532  } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_KWs.diminfo[0].shape)) __pyx_t_21 = 0;
9533  if (__pyx_t_16 < 0) {
9534  __pyx_t_16 += __pyx_pybuffernd_KWs.diminfo[1].shape;
9535  if (unlikely(__pyx_t_16 < 0)) __pyx_t_21 = 1;
9536  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_KWs.diminfo[1].shape)) __pyx_t_21 = 1;
9537  if (unlikely(__pyx_t_21 != -1)) {
9538  __Pyx_RaiseBufferIndexError(__pyx_t_21);
9539  __PYX_ERR(0, 347, __pyx_L1_error)
9540  }
9541  __pyx_t_18 = __pyx_v_ii;
9542  __pyx_t_21 = -1;
9543  if (__pyx_t_18 < 0) {
9544  __pyx_t_18 += __pyx_pybuffernd_a_neig.diminfo[0].shape;
9545  if (unlikely(__pyx_t_18 < 0)) __pyx_t_21 = 0;
9546  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_a_neig.diminfo[0].shape)) __pyx_t_21 = 0;
9547  if (unlikely(__pyx_t_21 != -1)) {
9548  __Pyx_RaiseBufferIndexError(__pyx_t_21);
9549  __PYX_ERR(0, 347, __pyx_L1_error)
9550  }
9551  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_neig.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_a_neig.diminfo[0].strides) = (__pyx_v_rho * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_KWs.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_KWs.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_KWs.diminfo[1].strides)));
9552  }
9553 
9554  /* "subsurfaceTransportFunctions.pyx":344
9555  * for ii in range(nnz):
9556  * a_neig[ii] = a_eN[ii]
9557  * if eN_neighbor >= 0: # <<<<<<<<<<<<<<
9558  * matID_neig = elementMaterialTypes[eN_neighbor]
9559  * for ii in range(nnz):
9560  */
9561  }
9562 
9563  /* "subsurfaceTransportFunctions.pyx":348
9564  * for ii in range(nnz):
9565  * a_neig[ii] = rho*KWs[matID_neig,ii]
9566  * for ii in range(nnz): # <<<<<<<<<<<<<<
9567  * a_avg[ii] = 2.0*a_eN[ii]*a_neig[ii]/(a_eN[ii]+a_neig[ii]+1.0e-20)
9568  * q_alin[eN,ebN,ii] = a_avg[ii]
9569  */
9570  __pyx_t_17 = __pyx_v_nnz;
9571  __pyx_t_19 = __pyx_t_17;
9572  for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
9573  __pyx_v_ii = __pyx_t_20;
9574 
9575  /* "subsurfaceTransportFunctions.pyx":349
9576  * a_neig[ii] = rho*KWs[matID_neig,ii]
9577  * for ii in range(nnz):
9578  * a_avg[ii] = 2.0*a_eN[ii]*a_neig[ii]/(a_eN[ii]+a_neig[ii]+1.0e-20) # <<<<<<<<<<<<<<
9579  * q_alin[eN,ebN,ii] = a_avg[ii]
9580  * for I in range(nSpace):
9581  */
9582  __pyx_t_16 = __pyx_v_ii;
9583  __pyx_t_21 = -1;
9584  if (__pyx_t_16 < 0) {
9585  __pyx_t_16 += __pyx_pybuffernd_a_eN.diminfo[0].shape;
9586  if (unlikely(__pyx_t_16 < 0)) __pyx_t_21 = 0;
9587  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_a_eN.diminfo[0].shape)) __pyx_t_21 = 0;
9588  if (unlikely(__pyx_t_21 != -1)) {
9589  __Pyx_RaiseBufferIndexError(__pyx_t_21);
9590  __PYX_ERR(0, 349, __pyx_L1_error)
9591  }
9592  __pyx_t_1 = __pyx_v_ii;
9593  __pyx_t_21 = -1;
9594  if (__pyx_t_1 < 0) {
9595  __pyx_t_1 += __pyx_pybuffernd_a_neig.diminfo[0].shape;
9596  if (unlikely(__pyx_t_1 < 0)) __pyx_t_21 = 0;
9597  } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_a_neig.diminfo[0].shape)) __pyx_t_21 = 0;
9598  if (unlikely(__pyx_t_21 != -1)) {
9599  __Pyx_RaiseBufferIndexError(__pyx_t_21);
9600  __PYX_ERR(0, 349, __pyx_L1_error)
9601  }
9602  __pyx_t_23 = ((2.0 * (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_eN.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_a_eN.diminfo[0].strides))) * (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_neig.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_a_neig.diminfo[0].strides)));
9603  __pyx_t_1 = __pyx_v_ii;
9604  __pyx_t_21 = -1;
9605  if (__pyx_t_1 < 0) {
9606  __pyx_t_1 += __pyx_pybuffernd_a_eN.diminfo[0].shape;
9607  if (unlikely(__pyx_t_1 < 0)) __pyx_t_21 = 0;
9608  } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_a_eN.diminfo[0].shape)) __pyx_t_21 = 0;
9609  if (unlikely(__pyx_t_21 != -1)) {
9610  __Pyx_RaiseBufferIndexError(__pyx_t_21);
9611  __PYX_ERR(0, 349, __pyx_L1_error)
9612  }
9613  __pyx_t_16 = __pyx_v_ii;
9614  __pyx_t_21 = -1;
9615  if (__pyx_t_16 < 0) {
9616  __pyx_t_16 += __pyx_pybuffernd_a_neig.diminfo[0].shape;
9617  if (unlikely(__pyx_t_16 < 0)) __pyx_t_21 = 0;
9618  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_a_neig.diminfo[0].shape)) __pyx_t_21 = 0;
9619  if (unlikely(__pyx_t_21 != -1)) {
9620  __Pyx_RaiseBufferIndexError(__pyx_t_21);
9621  __PYX_ERR(0, 349, __pyx_L1_error)
9622  }
9623  __pyx_t_24 = (((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_eN.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_a_eN.diminfo[0].strides)) + (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_neig.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_a_neig.diminfo[0].strides))) + 1.0e-20);
9624  if (unlikely(__pyx_t_24 == 0)) {
9625  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
9626  __PYX_ERR(0, 349, __pyx_L1_error)
9627  }
9628  __pyx_t_16 = __pyx_v_ii;
9629  __pyx_t_21 = -1;
9630  if (__pyx_t_16 < 0) {
9631  __pyx_t_16 += __pyx_pybuffernd_a_avg.diminfo[0].shape;
9632  if (unlikely(__pyx_t_16 < 0)) __pyx_t_21 = 0;
9633  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_a_avg.diminfo[0].shape)) __pyx_t_21 = 0;
9634  if (unlikely(__pyx_t_21 != -1)) {
9635  __Pyx_RaiseBufferIndexError(__pyx_t_21);
9636  __PYX_ERR(0, 349, __pyx_L1_error)
9637  }
9638  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_avg.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_a_avg.diminfo[0].strides) = (__pyx_t_23 / __pyx_t_24);
9639 
9640  /* "subsurfaceTransportFunctions.pyx":350
9641  * for ii in range(nnz):
9642  * a_avg[ii] = 2.0*a_eN[ii]*a_neig[ii]/(a_eN[ii]+a_neig[ii]+1.0e-20)
9643  * q_alin[eN,ebN,ii] = a_avg[ii] # <<<<<<<<<<<<<<
9644  * for I in range(nSpace):
9645  * q_flin[eN,ebN,I] = 0.0
9646  */
9647  __pyx_t_16 = __pyx_v_ii;
9648  __pyx_t_21 = -1;
9649  if (__pyx_t_16 < 0) {
9650  __pyx_t_16 += __pyx_pybuffernd_a_avg.diminfo[0].shape;
9651  if (unlikely(__pyx_t_16 < 0)) __pyx_t_21 = 0;
9652  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_a_avg.diminfo[0].shape)) __pyx_t_21 = 0;
9653  if (unlikely(__pyx_t_21 != -1)) {
9654  __Pyx_RaiseBufferIndexError(__pyx_t_21);
9655  __PYX_ERR(0, 350, __pyx_L1_error)
9656  }
9657  __pyx_t_1 = __pyx_v_eN;
9658  __pyx_t_18 = __pyx_v_ebN;
9659  __pyx_t_25 = __pyx_v_ii;
9660  __pyx_t_21 = -1;
9661  if (__pyx_t_1 < 0) {
9662  __pyx_t_1 += __pyx_pybuffernd_q_alin.diminfo[0].shape;
9663  if (unlikely(__pyx_t_1 < 0)) __pyx_t_21 = 0;
9664  } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_q_alin.diminfo[0].shape)) __pyx_t_21 = 0;
9665  if (__pyx_t_18 < 0) {
9666  __pyx_t_18 += __pyx_pybuffernd_q_alin.diminfo[1].shape;
9667  if (unlikely(__pyx_t_18 < 0)) __pyx_t_21 = 1;
9668  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_q_alin.diminfo[1].shape)) __pyx_t_21 = 1;
9669  if (__pyx_t_25 < 0) {
9670  __pyx_t_25 += __pyx_pybuffernd_q_alin.diminfo[2].shape;
9671  if (unlikely(__pyx_t_25 < 0)) __pyx_t_21 = 2;
9672  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_q_alin.diminfo[2].shape)) __pyx_t_21 = 2;
9673  if (unlikely(__pyx_t_21 != -1)) {
9674  __Pyx_RaiseBufferIndexError(__pyx_t_21);
9675  __PYX_ERR(0, 350, __pyx_L1_error)
9676  }
9677  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_q_alin.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_q_alin.diminfo[1].strides, __pyx_t_25, __pyx_pybuffernd_q_alin.diminfo[2].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_avg.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_a_avg.diminfo[0].strides));
9678  }
9679 
9680  /* "subsurfaceTransportFunctions.pyx":351
9681  * a_avg[ii] = 2.0*a_eN[ii]*a_neig[ii]/(a_eN[ii]+a_neig[ii]+1.0e-20)
9682  * q_alin[eN,ebN,ii] = a_avg[ii]
9683  * for I in range(nSpace): # <<<<<<<<<<<<<<
9684  * q_flin[eN,ebN,I] = 0.0
9685  * for ii in range(rowptr[I],rowptr[I+1]):
9686  */
9687  __pyx_t_17 = __pyx_v_nSpace;
9688  __pyx_t_19 = __pyx_t_17;
9689  for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
9690  __pyx_v_I = __pyx_t_20;
9691 
9692  /* "subsurfaceTransportFunctions.pyx":352
9693  * q_alin[eN,ebN,ii] = a_avg[ii]
9694  * for I in range(nSpace):
9695  * q_flin[eN,ebN,I] = 0.0 # <<<<<<<<<<<<<<
9696  * for ii in range(rowptr[I],rowptr[I+1]):
9697  * q_flin[eN,ebN,I] += rho*a_avg[ii]*gravity[colind[ii]]
9698  */
9699  __pyx_t_16 = __pyx_v_eN;
9700  __pyx_t_25 = __pyx_v_ebN;
9701  __pyx_t_18 = __pyx_v_I;
9702  __pyx_t_21 = -1;
9703  if (__pyx_t_16 < 0) {
9704  __pyx_t_16 += __pyx_pybuffernd_q_flin.diminfo[0].shape;
9705  if (unlikely(__pyx_t_16 < 0)) __pyx_t_21 = 0;
9706  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_q_flin.diminfo[0].shape)) __pyx_t_21 = 0;
9707  if (__pyx_t_25 < 0) {
9708  __pyx_t_25 += __pyx_pybuffernd_q_flin.diminfo[1].shape;
9709  if (unlikely(__pyx_t_25 < 0)) __pyx_t_21 = 1;
9710  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_q_flin.diminfo[1].shape)) __pyx_t_21 = 1;
9711  if (__pyx_t_18 < 0) {
9712  __pyx_t_18 += __pyx_pybuffernd_q_flin.diminfo[2].shape;
9713  if (unlikely(__pyx_t_18 < 0)) __pyx_t_21 = 2;
9714  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_q_flin.diminfo[2].shape)) __pyx_t_21 = 2;
9715  if (unlikely(__pyx_t_21 != -1)) {
9716  __Pyx_RaiseBufferIndexError(__pyx_t_21);
9717  __PYX_ERR(0, 352, __pyx_L1_error)
9718  }
9719  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_q_flin.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_q_flin.diminfo[1].strides, __pyx_t_18, __pyx_pybuffernd_q_flin.diminfo[2].strides) = 0.0;
9720 
9721  /* "subsurfaceTransportFunctions.pyx":353
9722  * for I in range(nSpace):
9723  * q_flin[eN,ebN,I] = 0.0
9724  * for ii in range(rowptr[I],rowptr[I+1]): # <<<<<<<<<<<<<<
9725  * q_flin[eN,ebN,I] += rho*a_avg[ii]*gravity[colind[ii]]
9726  * #ebN
9727  */
9728  __pyx_t_18 = (__pyx_v_I + 1);
9729  __pyx_t_21 = -1;
9730  if (__pyx_t_18 < 0) {
9731  __pyx_t_18 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
9732  if (unlikely(__pyx_t_18 < 0)) __pyx_t_21 = 0;
9733  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_21 = 0;
9734  if (unlikely(__pyx_t_21 != -1)) {
9735  __Pyx_RaiseBufferIndexError(__pyx_t_21);
9736  __PYX_ERR(0, 353, __pyx_L1_error)
9737  }
9738  __pyx_t_26 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_rowptr.diminfo[0].strides));
9739  __pyx_t_18 = __pyx_v_I;
9740  __pyx_t_21 = -1;
9741  if (__pyx_t_18 < 0) {
9742  __pyx_t_18 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
9743  if (unlikely(__pyx_t_18 < 0)) __pyx_t_21 = 0;
9744  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_21 = 0;
9745  if (unlikely(__pyx_t_21 != -1)) {
9746  __Pyx_RaiseBufferIndexError(__pyx_t_21);
9747  __PYX_ERR(0, 353, __pyx_L1_error)
9748  }
9749  __pyx_t_27 = __pyx_t_26;
9750  for (__pyx_t_21 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_rowptr.diminfo[0].strides)); __pyx_t_21 < __pyx_t_27; __pyx_t_21+=1) {
9751  __pyx_v_ii = __pyx_t_21;
9752 
9753  /* "subsurfaceTransportFunctions.pyx":354
9754  * q_flin[eN,ebN,I] = 0.0
9755  * for ii in range(rowptr[I],rowptr[I+1]):
9756  * q_flin[eN,ebN,I] += rho*a_avg[ii]*gravity[colind[ii]] # <<<<<<<<<<<<<<
9757  * #ebN
9758  * #eN
9759  */
9760  __pyx_t_25 = __pyx_v_ii;
9761  __pyx_t_28 = -1;
9762  if (__pyx_t_25 < 0) {
9763  __pyx_t_25 += __pyx_pybuffernd_a_avg.diminfo[0].shape;
9764  if (unlikely(__pyx_t_25 < 0)) __pyx_t_28 = 0;
9765  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_a_avg.diminfo[0].shape)) __pyx_t_28 = 0;
9766  if (unlikely(__pyx_t_28 != -1)) {
9767  __Pyx_RaiseBufferIndexError(__pyx_t_28);
9768  __PYX_ERR(0, 354, __pyx_L1_error)
9769  }
9770  __pyx_t_16 = __pyx_v_ii;
9771  __pyx_t_28 = -1;
9772  if (__pyx_t_16 < 0) {
9773  __pyx_t_16 += __pyx_pybuffernd_colind.diminfo[0].shape;
9774  if (unlikely(__pyx_t_16 < 0)) __pyx_t_28 = 0;
9775  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_colind.diminfo[0].shape)) __pyx_t_28 = 0;
9776  if (unlikely(__pyx_t_28 != -1)) {
9777  __Pyx_RaiseBufferIndexError(__pyx_t_28);
9778  __PYX_ERR(0, 354, __pyx_L1_error)
9779  }
9780  __pyx_t_1 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_colind.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_colind.diminfo[0].strides));
9781  __pyx_t_28 = -1;
9782  if (__pyx_t_1 < 0) {
9783  __pyx_t_1 += __pyx_pybuffernd_gravity.diminfo[0].shape;
9784  if (unlikely(__pyx_t_1 < 0)) __pyx_t_28 = 0;
9785  } else if (unlikely(__pyx_t_1 >= __pyx_pybuffernd_gravity.diminfo[0].shape)) __pyx_t_28 = 0;
9786  if (unlikely(__pyx_t_28 != -1)) {
9787  __Pyx_RaiseBufferIndexError(__pyx_t_28);
9788  __PYX_ERR(0, 354, __pyx_L1_error)
9789  }
9790  __pyx_t_29 = __pyx_v_eN;
9791  __pyx_t_30 = __pyx_v_ebN;
9792  __pyx_t_31 = __pyx_v_I;
9793  __pyx_t_28 = -1;
9794  if (__pyx_t_29 < 0) {
9795  __pyx_t_29 += __pyx_pybuffernd_q_flin.diminfo[0].shape;
9796  if (unlikely(__pyx_t_29 < 0)) __pyx_t_28 = 0;
9797  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_q_flin.diminfo[0].shape)) __pyx_t_28 = 0;
9798  if (__pyx_t_30 < 0) {
9799  __pyx_t_30 += __pyx_pybuffernd_q_flin.diminfo[1].shape;
9800  if (unlikely(__pyx_t_30 < 0)) __pyx_t_28 = 1;
9801  } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_q_flin.diminfo[1].shape)) __pyx_t_28 = 1;
9802  if (__pyx_t_31 < 0) {
9803  __pyx_t_31 += __pyx_pybuffernd_q_flin.diminfo[2].shape;
9804  if (unlikely(__pyx_t_31 < 0)) __pyx_t_28 = 2;
9805  } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_q_flin.diminfo[2].shape)) __pyx_t_28 = 2;
9806  if (unlikely(__pyx_t_28 != -1)) {
9807  __Pyx_RaiseBufferIndexError(__pyx_t_28);
9808  __PYX_ERR(0, 354, __pyx_L1_error)
9809  }
9810  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_q_flin.diminfo[0].strides, __pyx_t_30, __pyx_pybuffernd_q_flin.diminfo[1].strides, __pyx_t_31, __pyx_pybuffernd_q_flin.diminfo[2].strides) += ((__pyx_v_rho * (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_avg.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_a_avg.diminfo[0].strides))) * (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_gravity.rcbuffer->pybuffer.buf, __pyx_t_1, __pyx_pybuffernd_gravity.diminfo[0].strides)));
9811  }
9812  }
9813  }
9814  }
9815 
9816  /* "subsurfaceTransportFunctions.pyx":301
9817  *
9818  * ##################################################
9819  * def RE_NCP1_evaluateElementCoefficients_Linear(double rho, # <<<<<<<<<<<<<<
9820  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
9821  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
9822  */
9823 
9824  /* function exit code */
9825  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
9826  goto __pyx_L0;
9827  __pyx_L1_error:;
9828  __Pyx_XDECREF(__pyx_t_3);
9829  __Pyx_XDECREF(__pyx_t_4);
9830  __Pyx_XDECREF(__pyx_t_5);
9831  __Pyx_XDECREF(__pyx_t_6);
9832  __Pyx_XDECREF(__pyx_t_7);
9833  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
9834  __Pyx_PyThreadState_declare
9835  __Pyx_PyThreadState_assign
9836  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
9837  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_KWs.rcbuffer->pybuffer);
9838  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_avg.rcbuffer->pybuffer);
9839  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_eN.rcbuffer->pybuffer);
9840  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_neig.rcbuffer->pybuffer);
9841  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_colind.rcbuffer->pybuffer);
9842  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
9843  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
9844  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
9845  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer);
9846  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer);
9847  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer);
9848  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
9849  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_evaluateElementCoefficients_Linear", __pyx_clineno, __pyx_lineno, __pyx_filename);
9850  __pyx_r = NULL;
9851  goto __pyx_L2;
9852  __pyx_L0:;
9853  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_KWs.rcbuffer->pybuffer);
9854  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_avg.rcbuffer->pybuffer);
9855  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_eN.rcbuffer->pybuffer);
9856  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_neig.rcbuffer->pybuffer);
9857  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_colind.rcbuffer->pybuffer);
9858  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
9859  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
9860  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
9861  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer);
9862  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer);
9863  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer);
9864  __pyx_L2:;
9865  __Pyx_XDECREF((PyObject *)__pyx_v_a_eN);
9866  __Pyx_XDECREF((PyObject *)__pyx_v_a_neig);
9867  __Pyx_XDECREF((PyObject *)__pyx_v_a_avg);
9868  __Pyx_XGIVEREF(__pyx_r);
9869  __Pyx_RefNannyFinishContext();
9870  return __pyx_r;
9871 }
9872 
9873 /* "subsurfaceTransportFunctions.pyx":359
9874  *
9875  *
9876  * def RE_NCP1_evaluateElementCoefficients_VGM(double rho, # <<<<<<<<<<<<<<
9877  * double beta,
9878  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
9879  */
9880 
9881 /* Python wrapper */
9882 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_31RE_NCP1_evaluateElementCoefficients_VGM(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
9883 static char __pyx_doc_28subsurfaceTransportFunctions_30RE_NCP1_evaluateElementCoefficients_VGM[] = "\n routine for evaluating nodal coefficients in NCP1 approximation for conservative head formulation of Richards equation \n\n Approximation:\n uses nodal quadrature where the nodes are face barycenters\n uses harmonic average for intrinsic permeability/ hydraulic conductivity\n assumes slight compressiblity for now\n\n TODO:\n everything\n \n ";
9884 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_31RE_NCP1_evaluateElementCoefficients_VGM = {"RE_NCP1_evaluateElementCoefficients_VGM", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_31RE_NCP1_evaluateElementCoefficients_VGM, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_30RE_NCP1_evaluateElementCoefficients_VGM};
9885 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_31RE_NCP1_evaluateElementCoefficients_VGM(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
9886  double __pyx_v_rho;
9887  double __pyx_v_beta;
9888  PyArrayObject *__pyx_v_gravity = 0;
9889  PyArrayObject *__pyx_v_alpha = 0;
9890  PyArrayObject *__pyx_v_n = 0;
9891  PyArrayObject *__pyx_v_thetaR = 0;
9892  PyArrayObject *__pyx_v_thetaSR = 0;
9893  int __pyx_v_nSpace;
9894  int __pyx_v_nElements_global;
9895  int __pyx_v_nElementBoundaries_element;
9896  PyArrayObject *__pyx_v_elementNeighborsArray = 0;
9897  PyArrayObject *__pyx_v_elementBarycentersArray = 0;
9898  PyArrayObject *__pyx_v_elementMaterialTypes = 0;
9899  int __pyx_v_nDOF_trial_element;
9900  PyArrayObject *__pyx_v_u_l2g = 0;
9901  PyArrayObject *__pyx_v_u_dof = 0;
9902  CYTHON_UNUSED PyArrayObject *__pyx_v_q_x = 0;
9903  PyArrayObject *__pyx_v_q_u = 0;
9904  PyArrayObject *__pyx_v_q_mass = 0;
9905  PyArrayObject *__pyx_v_q_dmass = 0;
9906  PyArrayObject *__pyx_v_q_r = 0;
9907  PyArrayObject *__pyx_v_q_kr = 0;
9908  PyArrayObject *__pyx_v_q_dkr = 0;
9909  PyArrayObject *__pyx_v_q_kr_up = 0;
9910  int __pyx_lineno = 0;
9911  const char *__pyx_filename = NULL;
9912  int __pyx_clineno = 0;
9913  PyObject *__pyx_r = 0;
9914  __Pyx_RefNannyDeclarations
9915  __Pyx_RefNannySetupContext("RE_NCP1_evaluateElementCoefficients_VGM (wrapper)", 0);
9916  {
9917  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rho,&__pyx_n_s_beta,&__pyx_n_s_gravity,&__pyx_n_s_alpha,&__pyx_n_s_n,&__pyx_n_s_thetaR,&__pyx_n_s_thetaSR,&__pyx_n_s_nSpace,&__pyx_n_s_nElements_global,&__pyx_n_s_nElementBoundaries_element,&__pyx_n_s_elementNeighborsArray,&__pyx_n_s_elementBarycentersArray,&__pyx_n_s_elementMaterialTypes,&__pyx_n_s_nDOF_trial_element,&__pyx_n_s_u_l2g,&__pyx_n_s_u_dof,&__pyx_n_s_q_x,&__pyx_n_s_q_u,&__pyx_n_s_q_mass,&__pyx_n_s_q_dmass,&__pyx_n_s_q_r,&__pyx_n_s_q_kr,&__pyx_n_s_q_dkr,&__pyx_n_s_q_kr_up,0};
9918  PyObject* values[24] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
9919  if (unlikely(__pyx_kwds)) {
9920  Py_ssize_t kw_args;
9921  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
9922  switch (pos_args) {
9923  case 24: values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
9924  CYTHON_FALLTHROUGH;
9925  case 23: values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
9926  CYTHON_FALLTHROUGH;
9927  case 22: values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
9928  CYTHON_FALLTHROUGH;
9929  case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
9930  CYTHON_FALLTHROUGH;
9931  case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
9932  CYTHON_FALLTHROUGH;
9933  case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
9934  CYTHON_FALLTHROUGH;
9935  case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
9936  CYTHON_FALLTHROUGH;
9937  case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
9938  CYTHON_FALLTHROUGH;
9939  case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
9940  CYTHON_FALLTHROUGH;
9941  case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
9942  CYTHON_FALLTHROUGH;
9943  case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
9944  CYTHON_FALLTHROUGH;
9945  case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
9946  CYTHON_FALLTHROUGH;
9947  case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
9948  CYTHON_FALLTHROUGH;
9949  case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
9950  CYTHON_FALLTHROUGH;
9951  case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
9952  CYTHON_FALLTHROUGH;
9953  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
9954  CYTHON_FALLTHROUGH;
9955  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
9956  CYTHON_FALLTHROUGH;
9957  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
9958  CYTHON_FALLTHROUGH;
9959  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
9960  CYTHON_FALLTHROUGH;
9961  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
9962  CYTHON_FALLTHROUGH;
9963  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
9964  CYTHON_FALLTHROUGH;
9965  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
9966  CYTHON_FALLTHROUGH;
9967  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9968  CYTHON_FALLTHROUGH;
9969  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9970  CYTHON_FALLTHROUGH;
9971  case 0: break;
9972  default: goto __pyx_L5_argtuple_error;
9973  }
9974  kw_args = PyDict_Size(__pyx_kwds);
9975  switch (pos_args) {
9976  case 0:
9977  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rho)) != 0)) kw_args--;
9978  else goto __pyx_L5_argtuple_error;
9979  CYTHON_FALLTHROUGH;
9980  case 1:
9981  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_beta)) != 0)) kw_args--;
9982  else {
9983  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 1); __PYX_ERR(0, 359, __pyx_L3_error)
9984  }
9985  CYTHON_FALLTHROUGH;
9986  case 2:
9987  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gravity)) != 0)) kw_args--;
9988  else {
9989  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 2); __PYX_ERR(0, 359, __pyx_L3_error)
9990  }
9991  CYTHON_FALLTHROUGH;
9992  case 3:
9993  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha)) != 0)) kw_args--;
9994  else {
9995  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 3); __PYX_ERR(0, 359, __pyx_L3_error)
9996  }
9997  CYTHON_FALLTHROUGH;
9998  case 4:
9999  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
10000  else {
10001  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 4); __PYX_ERR(0, 359, __pyx_L3_error)
10002  }
10003  CYTHON_FALLTHROUGH;
10004  case 5:
10005  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_thetaR)) != 0)) kw_args--;
10006  else {
10007  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 5); __PYX_ERR(0, 359, __pyx_L3_error)
10008  }
10009  CYTHON_FALLTHROUGH;
10010  case 6:
10011  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_thetaSR)) != 0)) kw_args--;
10012  else {
10013  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 6); __PYX_ERR(0, 359, __pyx_L3_error)
10014  }
10015  CYTHON_FALLTHROUGH;
10016  case 7:
10017  if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nSpace)) != 0)) kw_args--;
10018  else {
10019  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 7); __PYX_ERR(0, 359, __pyx_L3_error)
10020  }
10021  CYTHON_FALLTHROUGH;
10022  case 8:
10023  if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElements_global)) != 0)) kw_args--;
10024  else {
10025  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 8); __PYX_ERR(0, 359, __pyx_L3_error)
10026  }
10027  CYTHON_FALLTHROUGH;
10028  case 9:
10029  if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElementBoundaries_element)) != 0)) kw_args--;
10030  else {
10031  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 9); __PYX_ERR(0, 359, __pyx_L3_error)
10032  }
10033  CYTHON_FALLTHROUGH;
10034  case 10:
10035  if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementNeighborsArray)) != 0)) kw_args--;
10036  else {
10037  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 10); __PYX_ERR(0, 359, __pyx_L3_error)
10038  }
10039  CYTHON_FALLTHROUGH;
10040  case 11:
10041  if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBarycentersArray)) != 0)) kw_args--;
10042  else {
10043  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 11); __PYX_ERR(0, 359, __pyx_L3_error)
10044  }
10045  CYTHON_FALLTHROUGH;
10046  case 12:
10047  if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementMaterialTypes)) != 0)) kw_args--;
10048  else {
10049  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 12); __PYX_ERR(0, 359, __pyx_L3_error)
10050  }
10051  CYTHON_FALLTHROUGH;
10052  case 13:
10053  if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nDOF_trial_element)) != 0)) kw_args--;
10054  else {
10055  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 13); __PYX_ERR(0, 359, __pyx_L3_error)
10056  }
10057  CYTHON_FALLTHROUGH;
10058  case 14:
10059  if (likely((values[14] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_u_l2g)) != 0)) kw_args--;
10060  else {
10061  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 14); __PYX_ERR(0, 359, __pyx_L3_error)
10062  }
10063  CYTHON_FALLTHROUGH;
10064  case 15:
10065  if (likely((values[15] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_u_dof)) != 0)) kw_args--;
10066  else {
10067  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 15); __PYX_ERR(0, 359, __pyx_L3_error)
10068  }
10069  CYTHON_FALLTHROUGH;
10070  case 16:
10071  if (likely((values[16] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_x)) != 0)) kw_args--;
10072  else {
10073  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 16); __PYX_ERR(0, 359, __pyx_L3_error)
10074  }
10075  CYTHON_FALLTHROUGH;
10076  case 17:
10077  if (likely((values[17] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_u)) != 0)) kw_args--;
10078  else {
10079  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 17); __PYX_ERR(0, 359, __pyx_L3_error)
10080  }
10081  CYTHON_FALLTHROUGH;
10082  case 18:
10083  if (likely((values[18] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_mass)) != 0)) kw_args--;
10084  else {
10085  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 18); __PYX_ERR(0, 359, __pyx_L3_error)
10086  }
10087  CYTHON_FALLTHROUGH;
10088  case 19:
10089  if (likely((values[19] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_dmass)) != 0)) kw_args--;
10090  else {
10091  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 19); __PYX_ERR(0, 359, __pyx_L3_error)
10092  }
10093  CYTHON_FALLTHROUGH;
10094  case 20:
10095  if (likely((values[20] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_r)) != 0)) kw_args--;
10096  else {
10097  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 20); __PYX_ERR(0, 359, __pyx_L3_error)
10098  }
10099  CYTHON_FALLTHROUGH;
10100  case 21:
10101  if (likely((values[21] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_kr)) != 0)) kw_args--;
10102  else {
10103  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 21); __PYX_ERR(0, 359, __pyx_L3_error)
10104  }
10105  CYTHON_FALLTHROUGH;
10106  case 22:
10107  if (likely((values[22] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_dkr)) != 0)) kw_args--;
10108  else {
10109  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 22); __PYX_ERR(0, 359, __pyx_L3_error)
10110  }
10111  CYTHON_FALLTHROUGH;
10112  case 23:
10113  if (likely((values[23] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_kr_up)) != 0)) kw_args--;
10114  else {
10115  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, 23); __PYX_ERR(0, 359, __pyx_L3_error)
10116  }
10117  }
10118  if (unlikely(kw_args > 0)) {
10119  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "RE_NCP1_evaluateElementCoefficients_VGM") < 0)) __PYX_ERR(0, 359, __pyx_L3_error)
10120  }
10121  } else if (PyTuple_GET_SIZE(__pyx_args) != 24) {
10122  goto __pyx_L5_argtuple_error;
10123  } else {
10124  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
10125  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
10126  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
10127  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
10128  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
10129  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
10130  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
10131  values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
10132  values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
10133  values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
10134  values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
10135  values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
10136  values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
10137  values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
10138  values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
10139  values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
10140  values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
10141  values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
10142  values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
10143  values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
10144  values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
10145  values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
10146  values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
10147  values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
10148  }
10149  __pyx_v_rho = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_rho == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 359, __pyx_L3_error)
10150  __pyx_v_beta = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_beta == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 360, __pyx_L3_error)
10151  __pyx_v_gravity = ((PyArrayObject *)values[2]);
10152  __pyx_v_alpha = ((PyArrayObject *)values[3]);
10153  __pyx_v_n = ((PyArrayObject *)values[4]);
10154  __pyx_v_thetaR = ((PyArrayObject *)values[5]);
10155  __pyx_v_thetaSR = ((PyArrayObject *)values[6]);
10156  __pyx_v_nSpace = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_nSpace == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 367, __pyx_L3_error)
10157  __pyx_v_nElements_global = __Pyx_PyInt_As_int(values[8]); if (unlikely((__pyx_v_nElements_global == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 368, __pyx_L3_error)
10158  __pyx_v_nElementBoundaries_element = __Pyx_PyInt_As_int(values[9]); if (unlikely((__pyx_v_nElementBoundaries_element == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 369, __pyx_L3_error)
10159  __pyx_v_elementNeighborsArray = ((PyArrayObject *)values[10]);
10160  __pyx_v_elementBarycentersArray = ((PyArrayObject *)values[11]);
10161  __pyx_v_elementMaterialTypes = ((PyArrayObject *)values[12]);
10162  __pyx_v_nDOF_trial_element = __Pyx_PyInt_As_int(values[13]); if (unlikely((__pyx_v_nDOF_trial_element == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 374, __pyx_L3_error)
10163  __pyx_v_u_l2g = ((PyArrayObject *)values[14]);
10164  __pyx_v_u_dof = ((PyArrayObject *)values[15]);
10165  __pyx_v_q_x = ((PyArrayObject *)values[16]);
10166  __pyx_v_q_u = ((PyArrayObject *)values[17]);
10167  __pyx_v_q_mass = ((PyArrayObject *)values[18]);
10168  __pyx_v_q_dmass = ((PyArrayObject *)values[19]);
10169  __pyx_v_q_r = ((PyArrayObject *)values[20]);
10170  __pyx_v_q_kr = ((PyArrayObject *)values[21]);
10171  __pyx_v_q_dkr = ((PyArrayObject *)values[22]);
10172  __pyx_v_q_kr_up = ((PyArrayObject *)values[23]);
10173  }
10174  goto __pyx_L4_argument_unpacking_done;
10175  __pyx_L5_argtuple_error:;
10176  __Pyx_RaiseArgtupleInvalid("RE_NCP1_evaluateElementCoefficients_VGM", 1, 24, 24, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 359, __pyx_L3_error)
10177  __pyx_L3_error:;
10178  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_evaluateElementCoefficients_VGM", __pyx_clineno, __pyx_lineno, __pyx_filename);
10179  __Pyx_RefNannyFinishContext();
10180  return NULL;
10181  __pyx_L4_argument_unpacking_done:;
10182  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gravity), __pyx_ptype_5numpy_ndarray, 1, "gravity", 0))) __PYX_ERR(0, 361, __pyx_L1_error)
10183  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_alpha), __pyx_ptype_5numpy_ndarray, 1, "alpha", 0))) __PYX_ERR(0, 362, __pyx_L1_error)
10184  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_n), __pyx_ptype_5numpy_ndarray, 1, "n", 0))) __PYX_ERR(0, 363, __pyx_L1_error)
10185  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_thetaR), __pyx_ptype_5numpy_ndarray, 1, "thetaR", 0))) __PYX_ERR(0, 364, __pyx_L1_error)
10186  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_thetaSR), __pyx_ptype_5numpy_ndarray, 1, "thetaSR", 0))) __PYX_ERR(0, 365, __pyx_L1_error)
10187  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementNeighborsArray), __pyx_ptype_5numpy_ndarray, 1, "elementNeighborsArray", 0))) __PYX_ERR(0, 370, __pyx_L1_error)
10188  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBarycentersArray), __pyx_ptype_5numpy_ndarray, 1, "elementBarycentersArray", 0))) __PYX_ERR(0, 371, __pyx_L1_error)
10189  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementMaterialTypes), __pyx_ptype_5numpy_ndarray, 1, "elementMaterialTypes", 0))) __PYX_ERR(0, 372, __pyx_L1_error)
10190  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_u_l2g), __pyx_ptype_5numpy_ndarray, 1, "u_l2g", 0))) __PYX_ERR(0, 375, __pyx_L1_error)
10191  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_u_dof), __pyx_ptype_5numpy_ndarray, 1, "u_dof", 0))) __PYX_ERR(0, 376, __pyx_L1_error)
10192  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_x), __pyx_ptype_5numpy_ndarray, 1, "q_x", 0))) __PYX_ERR(0, 378, __pyx_L1_error)
10193  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_u), __pyx_ptype_5numpy_ndarray, 1, "q_u", 0))) __PYX_ERR(0, 379, __pyx_L1_error)
10194  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_mass), __pyx_ptype_5numpy_ndarray, 1, "q_mass", 0))) __PYX_ERR(0, 380, __pyx_L1_error)
10195  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_dmass), __pyx_ptype_5numpy_ndarray, 1, "q_dmass", 0))) __PYX_ERR(0, 381, __pyx_L1_error)
10196  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_r), __pyx_ptype_5numpy_ndarray, 1, "q_r", 0))) __PYX_ERR(0, 382, __pyx_L1_error)
10197  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_kr), __pyx_ptype_5numpy_ndarray, 1, "q_kr", 0))) __PYX_ERR(0, 383, __pyx_L1_error)
10198  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_dkr), __pyx_ptype_5numpy_ndarray, 1, "q_dkr", 0))) __PYX_ERR(0, 384, __pyx_L1_error)
10199  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_kr_up), __pyx_ptype_5numpy_ndarray, 1, "q_kr_up", 0))) __PYX_ERR(0, 385, __pyx_L1_error)
10200  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_30RE_NCP1_evaluateElementCoefficients_VGM(__pyx_self, __pyx_v_rho, __pyx_v_beta, __pyx_v_gravity, __pyx_v_alpha, __pyx_v_n, __pyx_v_thetaR, __pyx_v_thetaSR, __pyx_v_nSpace, __pyx_v_nElements_global, __pyx_v_nElementBoundaries_element, __pyx_v_elementNeighborsArray, __pyx_v_elementBarycentersArray, __pyx_v_elementMaterialTypes, __pyx_v_nDOF_trial_element, __pyx_v_u_l2g, __pyx_v_u_dof, __pyx_v_q_x, __pyx_v_q_u, __pyx_v_q_mass, __pyx_v_q_dmass, __pyx_v_q_r, __pyx_v_q_kr, __pyx_v_q_dkr, __pyx_v_q_kr_up);
10201 
10202  /* function exit code */
10203  goto __pyx_L0;
10204  __pyx_L1_error:;
10205  __pyx_r = NULL;
10206  __pyx_L0:;
10207  __Pyx_RefNannyFinishContext();
10208  return __pyx_r;
10209 }
10210 
10211 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_30RE_NCP1_evaluateElementCoefficients_VGM(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_rho, double __pyx_v_beta, PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_alpha, PyArrayObject *__pyx_v_n, PyArrayObject *__pyx_v_thetaR, PyArrayObject *__pyx_v_thetaSR, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, PyArrayObject *__pyx_v_elementNeighborsArray, PyArrayObject *__pyx_v_elementBarycentersArray, PyArrayObject *__pyx_v_elementMaterialTypes, int __pyx_v_nDOF_trial_element, PyArrayObject *__pyx_v_u_l2g, PyArrayObject *__pyx_v_u_dof, CYTHON_UNUSED PyArrayObject *__pyx_v_q_x, PyArrayObject *__pyx_v_q_u, PyArrayObject *__pyx_v_q_mass, PyArrayObject *__pyx_v_q_dmass, PyArrayObject *__pyx_v_q_r, PyArrayObject *__pyx_v_q_kr, PyArrayObject *__pyx_v_q_dkr, PyArrayObject *__pyx_v_q_kr_up) {
10212  PyObject *__pyx_v_q = NULL;
10213  double __pyx_v_psiC;
10214  double __pyx_v_pcBar;
10215  double __pyx_v_pcBar_n;
10216  double __pyx_v_pcBar_nM1;
10217  double __pyx_v_pcBar_nM2;
10218  double __pyx_v_onePlus_pcBar_n;
10219  double __pyx_v_sBar;
10220  double __pyx_v_sqrt_sBar;
10221  double __pyx_v_DsBar_DpsiC;
10222  double __pyx_v_thetaW;
10223  double __pyx_v_DthetaW_DpsiC;
10224  double __pyx_v_vBar;
10225  double __pyx_v_vBar2;
10226  double __pyx_v_DvBar_DpsiC;
10227  double __pyx_v_KWr;
10228  double __pyx_v_DKWr_DpsiC;
10229  CYTHON_UNUSED double __pyx_v_rho2;
10230  double __pyx_v_thetaS;
10231  double __pyx_v_rhom;
10232  double __pyx_v_drhom;
10233  double __pyx_v_m;
10234  double __pyx_v_u_j;
10235  double __pyx_v_u_eN;
10236  double __pyx_v_u_neig;
10237  double __pyx_v_kr_eN;
10238  double __pyx_v_kr_neig;
10239  double __pyx_v_phi_eN;
10240  double __pyx_v_phi_neig;
10241  int __pyx_v_eN;
10242  int __pyx_v_eN_neighbor;
10243  int __pyx_v_ebN;
10244  int __pyx_v_j;
10245  int __pyx_v_matID;
10246  double __pyx_v_nAvgWeight;
10247  __Pyx_LocalBuf_ND __pyx_pybuffernd_alpha;
10248  __Pyx_Buffer __pyx_pybuffer_alpha;
10249  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBarycentersArray;
10250  __Pyx_Buffer __pyx_pybuffer_elementBarycentersArray;
10251  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementMaterialTypes;
10252  __Pyx_Buffer __pyx_pybuffer_elementMaterialTypes;
10253  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementNeighborsArray;
10254  __Pyx_Buffer __pyx_pybuffer_elementNeighborsArray;
10255  __Pyx_LocalBuf_ND __pyx_pybuffernd_gravity;
10256  __Pyx_Buffer __pyx_pybuffer_gravity;
10257  __Pyx_LocalBuf_ND __pyx_pybuffernd_n;
10258  __Pyx_Buffer __pyx_pybuffer_n;
10259  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_dkr;
10260  __Pyx_Buffer __pyx_pybuffer_q_dkr;
10261  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_dmass;
10262  __Pyx_Buffer __pyx_pybuffer_q_dmass;
10263  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_kr;
10264  __Pyx_Buffer __pyx_pybuffer_q_kr;
10265  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_kr_up;
10266  __Pyx_Buffer __pyx_pybuffer_q_kr_up;
10267  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_mass;
10268  __Pyx_Buffer __pyx_pybuffer_q_mass;
10269  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_r;
10270  __Pyx_Buffer __pyx_pybuffer_q_r;
10271  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_u;
10272  __Pyx_Buffer __pyx_pybuffer_q_u;
10273  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_x;
10274  __Pyx_Buffer __pyx_pybuffer_q_x;
10275  __Pyx_LocalBuf_ND __pyx_pybuffernd_thetaR;
10276  __Pyx_Buffer __pyx_pybuffer_thetaR;
10277  __Pyx_LocalBuf_ND __pyx_pybuffernd_thetaSR;
10278  __Pyx_Buffer __pyx_pybuffer_thetaSR;
10279  __Pyx_LocalBuf_ND __pyx_pybuffernd_u_dof;
10280  __Pyx_Buffer __pyx_pybuffer_u_dof;
10281  __Pyx_LocalBuf_ND __pyx_pybuffernd_u_l2g;
10282  __Pyx_Buffer __pyx_pybuffer_u_l2g;
10283  PyObject *__pyx_r = NULL;
10284  __Pyx_RefNannyDeclarations
10285  PyObject *__pyx_t_1 = NULL;
10286  PyObject *__pyx_t_2 = NULL;
10287  Py_ssize_t __pyx_t_3;
10288  PyObject *__pyx_t_4 = NULL;
10289  PyObject *__pyx_t_5 = NULL;
10290  int __pyx_t_6;
10291  double __pyx_t_7;
10292  int __pyx_t_8;
10293  int __pyx_t_9;
10294  int __pyx_t_10;
10295  Py_ssize_t __pyx_t_11;
10296  int __pyx_t_12;
10297  int __pyx_t_13;
10298  int __pyx_t_14;
10299  Py_ssize_t __pyx_t_15;
10300  int __pyx_t_16;
10301  Py_ssize_t __pyx_t_17;
10302  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_18;
10303  PyObject *__pyx_t_19 = NULL;
10304  PyObject *__pyx_t_20 = NULL;
10305  int __pyx_lineno = 0;
10306  const char *__pyx_filename = NULL;
10307  int __pyx_clineno = 0;
10308  __Pyx_RefNannySetupContext("RE_NCP1_evaluateElementCoefficients_VGM", 0);
10309  __pyx_pybuffer_gravity.pybuffer.buf = NULL;
10310  __pyx_pybuffer_gravity.refcount = 0;
10311  __pyx_pybuffernd_gravity.data = NULL;
10312  __pyx_pybuffernd_gravity.rcbuffer = &__pyx_pybuffer_gravity;
10313  __pyx_pybuffer_alpha.pybuffer.buf = NULL;
10314  __pyx_pybuffer_alpha.refcount = 0;
10315  __pyx_pybuffernd_alpha.data = NULL;
10316  __pyx_pybuffernd_alpha.rcbuffer = &__pyx_pybuffer_alpha;
10317  __pyx_pybuffer_n.pybuffer.buf = NULL;
10318  __pyx_pybuffer_n.refcount = 0;
10319  __pyx_pybuffernd_n.data = NULL;
10320  __pyx_pybuffernd_n.rcbuffer = &__pyx_pybuffer_n;
10321  __pyx_pybuffer_thetaR.pybuffer.buf = NULL;
10322  __pyx_pybuffer_thetaR.refcount = 0;
10323  __pyx_pybuffernd_thetaR.data = NULL;
10324  __pyx_pybuffernd_thetaR.rcbuffer = &__pyx_pybuffer_thetaR;
10325  __pyx_pybuffer_thetaSR.pybuffer.buf = NULL;
10326  __pyx_pybuffer_thetaSR.refcount = 0;
10327  __pyx_pybuffernd_thetaSR.data = NULL;
10328  __pyx_pybuffernd_thetaSR.rcbuffer = &__pyx_pybuffer_thetaSR;
10329  __pyx_pybuffer_elementNeighborsArray.pybuffer.buf = NULL;
10330  __pyx_pybuffer_elementNeighborsArray.refcount = 0;
10331  __pyx_pybuffernd_elementNeighborsArray.data = NULL;
10332  __pyx_pybuffernd_elementNeighborsArray.rcbuffer = &__pyx_pybuffer_elementNeighborsArray;
10333  __pyx_pybuffer_elementBarycentersArray.pybuffer.buf = NULL;
10334  __pyx_pybuffer_elementBarycentersArray.refcount = 0;
10335  __pyx_pybuffernd_elementBarycentersArray.data = NULL;
10336  __pyx_pybuffernd_elementBarycentersArray.rcbuffer = &__pyx_pybuffer_elementBarycentersArray;
10337  __pyx_pybuffer_elementMaterialTypes.pybuffer.buf = NULL;
10338  __pyx_pybuffer_elementMaterialTypes.refcount = 0;
10339  __pyx_pybuffernd_elementMaterialTypes.data = NULL;
10340  __pyx_pybuffernd_elementMaterialTypes.rcbuffer = &__pyx_pybuffer_elementMaterialTypes;
10341  __pyx_pybuffer_u_l2g.pybuffer.buf = NULL;
10342  __pyx_pybuffer_u_l2g.refcount = 0;
10343  __pyx_pybuffernd_u_l2g.data = NULL;
10344  __pyx_pybuffernd_u_l2g.rcbuffer = &__pyx_pybuffer_u_l2g;
10345  __pyx_pybuffer_u_dof.pybuffer.buf = NULL;
10346  __pyx_pybuffer_u_dof.refcount = 0;
10347  __pyx_pybuffernd_u_dof.data = NULL;
10348  __pyx_pybuffernd_u_dof.rcbuffer = &__pyx_pybuffer_u_dof;
10349  __pyx_pybuffer_q_x.pybuffer.buf = NULL;
10350  __pyx_pybuffer_q_x.refcount = 0;
10351  __pyx_pybuffernd_q_x.data = NULL;
10352  __pyx_pybuffernd_q_x.rcbuffer = &__pyx_pybuffer_q_x;
10353  __pyx_pybuffer_q_u.pybuffer.buf = NULL;
10354  __pyx_pybuffer_q_u.refcount = 0;
10355  __pyx_pybuffernd_q_u.data = NULL;
10356  __pyx_pybuffernd_q_u.rcbuffer = &__pyx_pybuffer_q_u;
10357  __pyx_pybuffer_q_mass.pybuffer.buf = NULL;
10358  __pyx_pybuffer_q_mass.refcount = 0;
10359  __pyx_pybuffernd_q_mass.data = NULL;
10360  __pyx_pybuffernd_q_mass.rcbuffer = &__pyx_pybuffer_q_mass;
10361  __pyx_pybuffer_q_dmass.pybuffer.buf = NULL;
10362  __pyx_pybuffer_q_dmass.refcount = 0;
10363  __pyx_pybuffernd_q_dmass.data = NULL;
10364  __pyx_pybuffernd_q_dmass.rcbuffer = &__pyx_pybuffer_q_dmass;
10365  __pyx_pybuffer_q_r.pybuffer.buf = NULL;
10366  __pyx_pybuffer_q_r.refcount = 0;
10367  __pyx_pybuffernd_q_r.data = NULL;
10368  __pyx_pybuffernd_q_r.rcbuffer = &__pyx_pybuffer_q_r;
10369  __pyx_pybuffer_q_kr.pybuffer.buf = NULL;
10370  __pyx_pybuffer_q_kr.refcount = 0;
10371  __pyx_pybuffernd_q_kr.data = NULL;
10372  __pyx_pybuffernd_q_kr.rcbuffer = &__pyx_pybuffer_q_kr;
10373  __pyx_pybuffer_q_dkr.pybuffer.buf = NULL;
10374  __pyx_pybuffer_q_dkr.refcount = 0;
10375  __pyx_pybuffernd_q_dkr.data = NULL;
10376  __pyx_pybuffernd_q_dkr.rcbuffer = &__pyx_pybuffer_q_dkr;
10377  __pyx_pybuffer_q_kr_up.pybuffer.buf = NULL;
10378  __pyx_pybuffer_q_kr_up.refcount = 0;
10379  __pyx_pybuffernd_q_kr_up.data = NULL;
10380  __pyx_pybuffernd_q_kr_up.rcbuffer = &__pyx_pybuffer_q_kr_up;
10381  {
10382  __Pyx_BufFmt_StackElem __pyx_stack[1];
10383  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer, (PyObject*)__pyx_v_gravity, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10384  }
10385  __pyx_pybuffernd_gravity.diminfo[0].strides = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_gravity.diminfo[0].shape = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.shape[0];
10386  {
10387  __Pyx_BufFmt_StackElem __pyx_stack[1];
10388  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_alpha.rcbuffer->pybuffer, (PyObject*)__pyx_v_alpha, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10389  }
10390  __pyx_pybuffernd_alpha.diminfo[0].strides = __pyx_pybuffernd_alpha.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_alpha.diminfo[0].shape = __pyx_pybuffernd_alpha.rcbuffer->pybuffer.shape[0];
10391  {
10392  __Pyx_BufFmt_StackElem __pyx_stack[1];
10393  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_n.rcbuffer->pybuffer, (PyObject*)__pyx_v_n, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10394  }
10395  __pyx_pybuffernd_n.diminfo[0].strides = __pyx_pybuffernd_n.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_n.diminfo[0].shape = __pyx_pybuffernd_n.rcbuffer->pybuffer.shape[0];
10396  {
10397  __Pyx_BufFmt_StackElem __pyx_stack[1];
10398  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_thetaR.rcbuffer->pybuffer, (PyObject*)__pyx_v_thetaR, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10399  }
10400  __pyx_pybuffernd_thetaR.diminfo[0].strides = __pyx_pybuffernd_thetaR.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_thetaR.diminfo[0].shape = __pyx_pybuffernd_thetaR.rcbuffer->pybuffer.shape[0];
10401  {
10402  __Pyx_BufFmt_StackElem __pyx_stack[1];
10403  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_thetaSR.rcbuffer->pybuffer, (PyObject*)__pyx_v_thetaSR, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10404  }
10405  __pyx_pybuffernd_thetaSR.diminfo[0].strides = __pyx_pybuffernd_thetaSR.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_thetaSR.diminfo[0].shape = __pyx_pybuffernd_thetaSR.rcbuffer->pybuffer.shape[0];
10406  {
10407  __Pyx_BufFmt_StackElem __pyx_stack[1];
10408  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementNeighborsArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10409  }
10410  __pyx_pybuffernd_elementNeighborsArray.diminfo[0].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[1];
10411  {
10412  __Pyx_BufFmt_StackElem __pyx_stack[1];
10413  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBarycentersArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10414  }
10415  __pyx_pybuffernd_elementBarycentersArray.diminfo[0].strides = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBarycentersArray.diminfo[0].shape = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBarycentersArray.diminfo[1].strides = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBarycentersArray.diminfo[1].shape = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.shape[1];
10416  {
10417  __Pyx_BufFmt_StackElem __pyx_stack[1];
10418  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementMaterialTypes, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10419  }
10420  __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape = __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.shape[0];
10421  {
10422  __Pyx_BufFmt_StackElem __pyx_stack[1];
10423  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_u_l2g.rcbuffer->pybuffer, (PyObject*)__pyx_v_u_l2g, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10424  }
10425  __pyx_pybuffernd_u_l2g.diminfo[0].strides = __pyx_pybuffernd_u_l2g.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_u_l2g.diminfo[0].shape = __pyx_pybuffernd_u_l2g.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_u_l2g.diminfo[1].strides = __pyx_pybuffernd_u_l2g.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_u_l2g.diminfo[1].shape = __pyx_pybuffernd_u_l2g.rcbuffer->pybuffer.shape[1];
10426  {
10427  __Pyx_BufFmt_StackElem __pyx_stack[1];
10428  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_u_dof.rcbuffer->pybuffer, (PyObject*)__pyx_v_u_dof, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10429  }
10430  __pyx_pybuffernd_u_dof.diminfo[0].strides = __pyx_pybuffernd_u_dof.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_u_dof.diminfo[0].shape = __pyx_pybuffernd_u_dof.rcbuffer->pybuffer.shape[0];
10431  {
10432  __Pyx_BufFmt_StackElem __pyx_stack[1];
10433  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10434  }
10435  __pyx_pybuffernd_q_x.diminfo[0].strides = __pyx_pybuffernd_q_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_x.diminfo[0].shape = __pyx_pybuffernd_q_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_x.diminfo[1].strides = __pyx_pybuffernd_q_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_x.diminfo[1].shape = __pyx_pybuffernd_q_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_x.diminfo[2].strides = __pyx_pybuffernd_q_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_x.diminfo[2].shape = __pyx_pybuffernd_q_x.rcbuffer->pybuffer.shape[2];
10436  {
10437  __Pyx_BufFmt_StackElem __pyx_stack[1];
10438  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_u, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10439  }
10440  __pyx_pybuffernd_q_u.diminfo[0].strides = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_u.diminfo[0].shape = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_u.diminfo[1].strides = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_u.diminfo[1].shape = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.shape[1];
10441  {
10442  __Pyx_BufFmt_StackElem __pyx_stack[1];
10443  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_mass.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_mass, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10444  }
10445  __pyx_pybuffernd_q_mass.diminfo[0].strides = __pyx_pybuffernd_q_mass.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_mass.diminfo[0].shape = __pyx_pybuffernd_q_mass.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_mass.diminfo[1].strides = __pyx_pybuffernd_q_mass.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_mass.diminfo[1].shape = __pyx_pybuffernd_q_mass.rcbuffer->pybuffer.shape[1];
10446  {
10447  __Pyx_BufFmt_StackElem __pyx_stack[1];
10448  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_dmass.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_dmass, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10449  }
10450  __pyx_pybuffernd_q_dmass.diminfo[0].strides = __pyx_pybuffernd_q_dmass.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_dmass.diminfo[0].shape = __pyx_pybuffernd_q_dmass.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_dmass.diminfo[1].strides = __pyx_pybuffernd_q_dmass.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_dmass.diminfo[1].shape = __pyx_pybuffernd_q_dmass.rcbuffer->pybuffer.shape[1];
10451  {
10452  __Pyx_BufFmt_StackElem __pyx_stack[1];
10453  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_r, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10454  }
10455  __pyx_pybuffernd_q_r.diminfo[0].strides = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_r.diminfo[0].shape = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_r.diminfo[1].strides = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_r.diminfo[1].shape = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.shape[1];
10456  {
10457  __Pyx_BufFmt_StackElem __pyx_stack[1];
10458  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_kr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10459  }
10460  __pyx_pybuffernd_q_kr.diminfo[0].strides = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_kr.diminfo[0].shape = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_kr.diminfo[1].strides = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_kr.diminfo[1].shape = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.shape[1];
10461  {
10462  __Pyx_BufFmt_StackElem __pyx_stack[1];
10463  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_dkr.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_dkr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10464  }
10465  __pyx_pybuffernd_q_dkr.diminfo[0].strides = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_dkr.diminfo[0].shape = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_dkr.diminfo[1].strides = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_dkr.diminfo[1].shape = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.shape[1];
10466  {
10467  __Pyx_BufFmt_StackElem __pyx_stack[1];
10468  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_kr_up, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 359, __pyx_L1_error)
10469  }
10470  __pyx_pybuffernd_q_kr_up.diminfo[0].strides = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_kr_up.diminfo[0].shape = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_kr_up.diminfo[1].strides = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_kr_up.diminfo[1].shape = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.shape[1];
10471 
10472  /* "subsurfaceTransportFunctions.pyx":399
10473  * """
10474  * #check some sizes
10475  * for q in [q_u,q_mass,q_r,q_kr,q_dkr]: # <<<<<<<<<<<<<<
10476  * assert q.shape[1] == nSpace+1
10477  * assert nDOF_trial_element == nSpace + 1
10478  */
10479  __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 399, __pyx_L1_error)
10480  __Pyx_GOTREF(__pyx_t_1);
10481  __Pyx_INCREF(((PyObject *)__pyx_v_q_u));
10482  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_u));
10483  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_q_u));
10484  __Pyx_INCREF(((PyObject *)__pyx_v_q_mass));
10485  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_mass));
10486  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_q_mass));
10487  __Pyx_INCREF(((PyObject *)__pyx_v_q_r));
10488  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_r));
10489  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_q_r));
10490  __Pyx_INCREF(((PyObject *)__pyx_v_q_kr));
10491  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_kr));
10492  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_v_q_kr));
10493  __Pyx_INCREF(((PyObject *)__pyx_v_q_dkr));
10494  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_dkr));
10495  PyTuple_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_v_q_dkr));
10496  __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
10497  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10498  for (;;) {
10499  if (__pyx_t_3 >= 5) break;
10500  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
10501  __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 399, __pyx_L1_error)
10502  #else
10503  __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 399, __pyx_L1_error)
10504  __Pyx_GOTREF(__pyx_t_1);
10505  #endif
10506  __Pyx_XDECREF_SET(__pyx_v_q, __pyx_t_1);
10507  __pyx_t_1 = 0;
10508 
10509  /* "subsurfaceTransportFunctions.pyx":400
10510  * #check some sizes
10511  * for q in [q_u,q_mass,q_r,q_kr,q_dkr]:
10512  * assert q.shape[1] == nSpace+1 # <<<<<<<<<<<<<<
10513  * assert nDOF_trial_element == nSpace + 1
10514  * #temporaries
10515  */
10516  #ifndef CYTHON_WITHOUT_ASSERTIONS
10517  if (unlikely(!Py_OptimizeFlag)) {
10518  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_q, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 400, __pyx_L1_error)
10519  __Pyx_GOTREF(__pyx_t_1);
10520  __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 400, __pyx_L1_error)
10521  __Pyx_GOTREF(__pyx_t_4);
10522  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10523  __pyx_t_1 = __Pyx_PyInt_From_long((__pyx_v_nSpace + 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 400, __pyx_L1_error)
10524  __Pyx_GOTREF(__pyx_t_1);
10525  __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 400, __pyx_L1_error)
10526  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10527  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10528  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 400, __pyx_L1_error)
10529  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10530  if (unlikely(!__pyx_t_6)) {
10531  PyErr_SetNone(PyExc_AssertionError);
10532  __PYX_ERR(0, 400, __pyx_L1_error)
10533  }
10534  }
10535  #endif
10536 
10537  /* "subsurfaceTransportFunctions.pyx":399
10538  * """
10539  * #check some sizes
10540  * for q in [q_u,q_mass,q_r,q_kr,q_dkr]: # <<<<<<<<<<<<<<
10541  * assert q.shape[1] == nSpace+1
10542  * assert nDOF_trial_element == nSpace + 1
10543  */
10544  }
10545  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10546 
10547  /* "subsurfaceTransportFunctions.pyx":401
10548  * for q in [q_u,q_mass,q_r,q_kr,q_dkr]:
10549  * assert q.shape[1] == nSpace+1
10550  * assert nDOF_trial_element == nSpace + 1 # <<<<<<<<<<<<<<
10551  * #temporaries
10552  * cdef double psiC,pcBar,pcBar_n,pcBar_nM1,pcBar_nM2,onePlus_pcBar_n,sBar,sqrt_sBar,DsBar_DpsiC,thetaW,DthetaW_DpsiC
10553  */
10554  #ifndef CYTHON_WITHOUT_ASSERTIONS
10555  if (unlikely(!Py_OptimizeFlag)) {
10556  if (unlikely(!((__pyx_v_nDOF_trial_element == (__pyx_v_nSpace + 1)) != 0))) {
10557  PyErr_SetNone(PyExc_AssertionError);
10558  __PYX_ERR(0, 401, __pyx_L1_error)
10559  }
10560  }
10561  #endif
10562 
10563  /* "subsurfaceTransportFunctions.pyx":404
10564  * #temporaries
10565  * cdef double psiC,pcBar,pcBar_n,pcBar_nM1,pcBar_nM2,onePlus_pcBar_n,sBar,sqrt_sBar,DsBar_DpsiC,thetaW,DthetaW_DpsiC
10566  * cdef double vBar,vBar2,DvBar_DpsiC,KWr,DKWr_DpsiC,rho2=rho*rho,thetaS,rhom,drhom,m # <<<<<<<<<<<<<<
10567  *
10568  * cdef double u_j,u_eN,u_neig,kr_eN,kr_neig,phi_eN,phi_neig
10569  */
10570  __pyx_v_rho2 = (__pyx_v_rho * __pyx_v_rho);
10571 
10572  /* "subsurfaceTransportFunctions.pyx":409
10573  * cdef int eN,eN_neighbor,ebN,ii,I,j,matID
10574  * #for averaging/integration weights
10575  * cdef double nAvgWeight = 1.0/(nSpace+1.) # <<<<<<<<<<<<<<
10576  *
10577  * #loop through and evaluate
10578  */
10579  __pyx_t_7 = (__pyx_v_nSpace + 1.);
10580  if (unlikely(__pyx_t_7 == 0)) {
10581  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
10582  __PYX_ERR(0, 409, __pyx_L1_error)
10583  }
10584  __pyx_v_nAvgWeight = (1.0 / __pyx_t_7);
10585 
10586  /* "subsurfaceTransportFunctions.pyx":412
10587  *
10588  * #loop through and evaluate
10589  * for eN in range(nElements_global): # <<<<<<<<<<<<<<
10590  * matID = elementMaterialTypes[eN]
10591  * for j in range(nDOF_trial_element):
10592  */
10593  __pyx_t_8 = __pyx_v_nElements_global;
10594  __pyx_t_9 = __pyx_t_8;
10595  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
10596  __pyx_v_eN = __pyx_t_10;
10597 
10598  /* "subsurfaceTransportFunctions.pyx":413
10599  * #loop through and evaluate
10600  * for eN in range(nElements_global):
10601  * matID = elementMaterialTypes[eN] # <<<<<<<<<<<<<<
10602  * for j in range(nDOF_trial_element):
10603  * u_j = u_dof[u_l2g[eN,j]]
10604  */
10605  __pyx_t_11 = __pyx_v_eN;
10606  __pyx_t_12 = -1;
10607  if (__pyx_t_11 < 0) {
10608  __pyx_t_11 += __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape;
10609  if (unlikely(__pyx_t_11 < 0)) __pyx_t_12 = 0;
10610  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_elementMaterialTypes.diminfo[0].shape)) __pyx_t_12 = 0;
10611  if (unlikely(__pyx_t_12 != -1)) {
10612  __Pyx_RaiseBufferIndexError(__pyx_t_12);
10613  __PYX_ERR(0, 413, __pyx_L1_error)
10614  }
10615  __pyx_v_matID = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_elementMaterialTypes.diminfo[0].strides));
10616 
10617  /* "subsurfaceTransportFunctions.pyx":414
10618  * for eN in range(nElements_global):
10619  * matID = elementMaterialTypes[eN]
10620  * for j in range(nDOF_trial_element): # <<<<<<<<<<<<<<
10621  * u_j = u_dof[u_l2g[eN,j]]
10622  * q_u[eN,j] = u_j
10623  */
10624  __pyx_t_12 = __pyx_v_nDOF_trial_element;
10625  __pyx_t_13 = __pyx_t_12;
10626  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
10627  __pyx_v_j = __pyx_t_14;
10628 
10629  /* "subsurfaceTransportFunctions.pyx":415
10630  * matID = elementMaterialTypes[eN]
10631  * for j in range(nDOF_trial_element):
10632  * u_j = u_dof[u_l2g[eN,j]] # <<<<<<<<<<<<<<
10633  * q_u[eN,j] = u_j
10634  *
10635  */
10636  __pyx_t_11 = __pyx_v_eN;
10637  __pyx_t_15 = __pyx_v_j;
10638  __pyx_t_16 = -1;
10639  if (__pyx_t_11 < 0) {
10640  __pyx_t_11 += __pyx_pybuffernd_u_l2g.diminfo[0].shape;
10641  if (unlikely(__pyx_t_11 < 0)) __pyx_t_16 = 0;
10642  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_u_l2g.diminfo[0].shape)) __pyx_t_16 = 0;
10643  if (__pyx_t_15 < 0) {
10644  __pyx_t_15 += __pyx_pybuffernd_u_l2g.diminfo[1].shape;
10645  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 1;
10646  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_u_l2g.diminfo[1].shape)) __pyx_t_16 = 1;
10647  if (unlikely(__pyx_t_16 != -1)) {
10648  __Pyx_RaiseBufferIndexError(__pyx_t_16);
10649  __PYX_ERR(0, 415, __pyx_L1_error)
10650  }
10651  __pyx_t_17 = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_u_l2g.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_u_l2g.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_u_l2g.diminfo[1].strides));
10652  __pyx_t_16 = -1;
10653  if (__pyx_t_17 < 0) {
10654  __pyx_t_17 += __pyx_pybuffernd_u_dof.diminfo[0].shape;
10655  if (unlikely(__pyx_t_17 < 0)) __pyx_t_16 = 0;
10656  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_u_dof.diminfo[0].shape)) __pyx_t_16 = 0;
10657  if (unlikely(__pyx_t_16 != -1)) {
10658  __Pyx_RaiseBufferIndexError(__pyx_t_16);
10659  __PYX_ERR(0, 415, __pyx_L1_error)
10660  }
10661  __pyx_v_u_j = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_u_dof.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_u_dof.diminfo[0].strides));
10662 
10663  /* "subsurfaceTransportFunctions.pyx":416
10664  * for j in range(nDOF_trial_element):
10665  * u_j = u_dof[u_l2g[eN,j]]
10666  * q_u[eN,j] = u_j # <<<<<<<<<<<<<<
10667  *
10668  * #VGM evaluation
10669  */
10670  __pyx_t_15 = __pyx_v_eN;
10671  __pyx_t_11 = __pyx_v_j;
10672  __pyx_t_16 = -1;
10673  if (__pyx_t_15 < 0) {
10674  __pyx_t_15 += __pyx_pybuffernd_q_u.diminfo[0].shape;
10675  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 0;
10676  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_u.diminfo[0].shape)) __pyx_t_16 = 0;
10677  if (__pyx_t_11 < 0) {
10678  __pyx_t_11 += __pyx_pybuffernd_q_u.diminfo[1].shape;
10679  if (unlikely(__pyx_t_11 < 0)) __pyx_t_16 = 1;
10680  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_q_u.diminfo[1].shape)) __pyx_t_16 = 1;
10681  if (unlikely(__pyx_t_16 != -1)) {
10682  __Pyx_RaiseBufferIndexError(__pyx_t_16);
10683  __PYX_ERR(0, 416, __pyx_L1_error)
10684  }
10685  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_u.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_q_u.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_q_u.diminfo[1].strides) = __pyx_v_u_j;
10686 
10687  /* "subsurfaceTransportFunctions.pyx":419
10688  *
10689  * #VGM evaluation
10690  * psiC = -u_j # <<<<<<<<<<<<<<
10691  * m = 1.0 - 1.0/n[matID]
10692  * thetaS = thetaR[matID] + thetaSR[matID]
10693  */
10694  __pyx_v_psiC = (-__pyx_v_u_j);
10695 
10696  /* "subsurfaceTransportFunctions.pyx":420
10697  * #VGM evaluation
10698  * psiC = -u_j
10699  * m = 1.0 - 1.0/n[matID] # <<<<<<<<<<<<<<
10700  * thetaS = thetaR[matID] + thetaSR[matID]
10701  * if psiC > 0.0:
10702  */
10703  __pyx_t_11 = __pyx_v_matID;
10704  __pyx_t_16 = -1;
10705  if (__pyx_t_11 < 0) {
10706  __pyx_t_11 += __pyx_pybuffernd_n.diminfo[0].shape;
10707  if (unlikely(__pyx_t_11 < 0)) __pyx_t_16 = 0;
10708  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_n.diminfo[0].shape)) __pyx_t_16 = 0;
10709  if (unlikely(__pyx_t_16 != -1)) {
10710  __Pyx_RaiseBufferIndexError(__pyx_t_16);
10711  __PYX_ERR(0, 420, __pyx_L1_error)
10712  }
10713  __pyx_t_18 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_n.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_n.diminfo[0].strides));
10714  if (unlikely(__pyx_t_18 == 0)) {
10715  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
10716  __PYX_ERR(0, 420, __pyx_L1_error)
10717  }
10718  __pyx_v_m = (1.0 - (1.0 / __pyx_t_18));
10719 
10720  /* "subsurfaceTransportFunctions.pyx":421
10721  * psiC = -u_j
10722  * m = 1.0 - 1.0/n[matID]
10723  * thetaS = thetaR[matID] + thetaSR[matID] # <<<<<<<<<<<<<<
10724  * if psiC > 0.0:
10725  * pcBar = alpha[matID]*psiC
10726  */
10727  __pyx_t_11 = __pyx_v_matID;
10728  __pyx_t_16 = -1;
10729  if (__pyx_t_11 < 0) {
10730  __pyx_t_11 += __pyx_pybuffernd_thetaR.diminfo[0].shape;
10731  if (unlikely(__pyx_t_11 < 0)) __pyx_t_16 = 0;
10732  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_thetaR.diminfo[0].shape)) __pyx_t_16 = 0;
10733  if (unlikely(__pyx_t_16 != -1)) {
10734  __Pyx_RaiseBufferIndexError(__pyx_t_16);
10735  __PYX_ERR(0, 421, __pyx_L1_error)
10736  }
10737  __pyx_t_15 = __pyx_v_matID;
10738  __pyx_t_16 = -1;
10739  if (__pyx_t_15 < 0) {
10740  __pyx_t_15 += __pyx_pybuffernd_thetaSR.diminfo[0].shape;
10741  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 0;
10742  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_thetaSR.diminfo[0].shape)) __pyx_t_16 = 0;
10743  if (unlikely(__pyx_t_16 != -1)) {
10744  __Pyx_RaiseBufferIndexError(__pyx_t_16);
10745  __PYX_ERR(0, 421, __pyx_L1_error)
10746  }
10747  __pyx_v_thetaS = ((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_thetaR.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_thetaR.diminfo[0].strides)) + (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_thetaSR.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_thetaSR.diminfo[0].strides)));
10748 
10749  /* "subsurfaceTransportFunctions.pyx":422
10750  * m = 1.0 - 1.0/n[matID]
10751  * thetaS = thetaR[matID] + thetaSR[matID]
10752  * if psiC > 0.0: # <<<<<<<<<<<<<<
10753  * pcBar = alpha[matID]*psiC
10754  * pcBar_nM2 = pow(pcBar,n[matID]-2)
10755  */
10756  __pyx_t_6 = ((__pyx_v_psiC > 0.0) != 0);
10757  if (__pyx_t_6) {
10758 
10759  /* "subsurfaceTransportFunctions.pyx":423
10760  * thetaS = thetaR[matID] + thetaSR[matID]
10761  * if psiC > 0.0:
10762  * pcBar = alpha[matID]*psiC # <<<<<<<<<<<<<<
10763  * pcBar_nM2 = pow(pcBar,n[matID]-2)
10764  * pcBar_nM1 = pcBar_nM2*pcBar
10765  */
10766  __pyx_t_15 = __pyx_v_matID;
10767  __pyx_t_16 = -1;
10768  if (__pyx_t_15 < 0) {
10769  __pyx_t_15 += __pyx_pybuffernd_alpha.diminfo[0].shape;
10770  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 0;
10771  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_alpha.diminfo[0].shape)) __pyx_t_16 = 0;
10772  if (unlikely(__pyx_t_16 != -1)) {
10773  __Pyx_RaiseBufferIndexError(__pyx_t_16);
10774  __PYX_ERR(0, 423, __pyx_L1_error)
10775  }
10776  __pyx_v_pcBar = ((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_alpha.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_alpha.diminfo[0].strides)) * __pyx_v_psiC);
10777 
10778  /* "subsurfaceTransportFunctions.pyx":424
10779  * if psiC > 0.0:
10780  * pcBar = alpha[matID]*psiC
10781  * pcBar_nM2 = pow(pcBar,n[matID]-2) # <<<<<<<<<<<<<<
10782  * pcBar_nM1 = pcBar_nM2*pcBar
10783  * pcBar_n = pcBar_nM1*pcBar
10784  */
10785  __pyx_t_15 = __pyx_v_matID;
10786  __pyx_t_16 = -1;
10787  if (__pyx_t_15 < 0) {
10788  __pyx_t_15 += __pyx_pybuffernd_n.diminfo[0].shape;
10789  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 0;
10790  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_n.diminfo[0].shape)) __pyx_t_16 = 0;
10791  if (unlikely(__pyx_t_16 != -1)) {
10792  __Pyx_RaiseBufferIndexError(__pyx_t_16);
10793  __PYX_ERR(0, 424, __pyx_L1_error)
10794  }
10795  __pyx_v_pcBar_nM2 = pow(__pyx_v_pcBar, ((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_n.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_n.diminfo[0].strides)) - 2.0));
10796 
10797  /* "subsurfaceTransportFunctions.pyx":425
10798  * pcBar = alpha[matID]*psiC
10799  * pcBar_nM2 = pow(pcBar,n[matID]-2)
10800  * pcBar_nM1 = pcBar_nM2*pcBar # <<<<<<<<<<<<<<
10801  * pcBar_n = pcBar_nM1*pcBar
10802  * onePlus_pcBar_n = 1.0 + pcBar_n
10803  */
10804  __pyx_v_pcBar_nM1 = (__pyx_v_pcBar_nM2 * __pyx_v_pcBar);
10805 
10806  /* "subsurfaceTransportFunctions.pyx":426
10807  * pcBar_nM2 = pow(pcBar,n[matID]-2)
10808  * pcBar_nM1 = pcBar_nM2*pcBar
10809  * pcBar_n = pcBar_nM1*pcBar # <<<<<<<<<<<<<<
10810  * onePlus_pcBar_n = 1.0 + pcBar_n
10811  *
10812  */
10813  __pyx_v_pcBar_n = (__pyx_v_pcBar_nM1 * __pyx_v_pcBar);
10814 
10815  /* "subsurfaceTransportFunctions.pyx":427
10816  * pcBar_nM1 = pcBar_nM2*pcBar
10817  * pcBar_n = pcBar_nM1*pcBar
10818  * onePlus_pcBar_n = 1.0 + pcBar_n # <<<<<<<<<<<<<<
10819  *
10820  * sBar = pow(onePlus_pcBar_n,-m)
10821  */
10822  __pyx_v_onePlus_pcBar_n = (1.0 + __pyx_v_pcBar_n);
10823 
10824  /* "subsurfaceTransportFunctions.pyx":429
10825  * onePlus_pcBar_n = 1.0 + pcBar_n
10826  *
10827  * sBar = pow(onePlus_pcBar_n,-m) # <<<<<<<<<<<<<<
10828  * # using -mn = 1-n
10829  * DsBar_DpsiC = alpha[matID]*(1.0-n[matID])*(sBar/onePlus_pcBar_n)*pcBar_nM1
10830  */
10831  __pyx_v_sBar = pow(__pyx_v_onePlus_pcBar_n, (-__pyx_v_m));
10832 
10833  /* "subsurfaceTransportFunctions.pyx":431
10834  * sBar = pow(onePlus_pcBar_n,-m)
10835  * # using -mn = 1-n
10836  * DsBar_DpsiC = alpha[matID]*(1.0-n[matID])*(sBar/onePlus_pcBar_n)*pcBar_nM1 # <<<<<<<<<<<<<<
10837  *
10838  * vBar = 1.0-pcBar_nM1*sBar
10839  */
10840  __pyx_t_15 = __pyx_v_matID;
10841  __pyx_t_16 = -1;
10842  if (__pyx_t_15 < 0) {
10843  __pyx_t_15 += __pyx_pybuffernd_alpha.diminfo[0].shape;
10844  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 0;
10845  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_alpha.diminfo[0].shape)) __pyx_t_16 = 0;
10846  if (unlikely(__pyx_t_16 != -1)) {
10847  __Pyx_RaiseBufferIndexError(__pyx_t_16);
10848  __PYX_ERR(0, 431, __pyx_L1_error)
10849  }
10850  __pyx_t_11 = __pyx_v_matID;
10851  __pyx_t_16 = -1;
10852  if (__pyx_t_11 < 0) {
10853  __pyx_t_11 += __pyx_pybuffernd_n.diminfo[0].shape;
10854  if (unlikely(__pyx_t_11 < 0)) __pyx_t_16 = 0;
10855  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_n.diminfo[0].shape)) __pyx_t_16 = 0;
10856  if (unlikely(__pyx_t_16 != -1)) {
10857  __Pyx_RaiseBufferIndexError(__pyx_t_16);
10858  __PYX_ERR(0, 431, __pyx_L1_error)
10859  }
10860  if (unlikely(__pyx_v_onePlus_pcBar_n == 0)) {
10861  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
10862  __PYX_ERR(0, 431, __pyx_L1_error)
10863  }
10864  __pyx_v_DsBar_DpsiC = ((((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_alpha.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_alpha.diminfo[0].strides)) * (1.0 - (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_n.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_n.diminfo[0].strides)))) * (__pyx_v_sBar / __pyx_v_onePlus_pcBar_n)) * __pyx_v_pcBar_nM1);
10865 
10866  /* "subsurfaceTransportFunctions.pyx":433
10867  * DsBar_DpsiC = alpha[matID]*(1.0-n[matID])*(sBar/onePlus_pcBar_n)*pcBar_nM1
10868  *
10869  * vBar = 1.0-pcBar_nM1*sBar # <<<<<<<<<<<<<<
10870  * vBar2 = vBar*vBar
10871  * DvBar_DpsiC = -alpha[matID]*(n[matID]-1.0)*pcBar_nM2*sBar - pcBar_nM1*DsBar_DpsiC
10872  */
10873  __pyx_v_vBar = (1.0 - (__pyx_v_pcBar_nM1 * __pyx_v_sBar));
10874 
10875  /* "subsurfaceTransportFunctions.pyx":434
10876  *
10877  * vBar = 1.0-pcBar_nM1*sBar
10878  * vBar2 = vBar*vBar # <<<<<<<<<<<<<<
10879  * DvBar_DpsiC = -alpha[matID]*(n[matID]-1.0)*pcBar_nM2*sBar - pcBar_nM1*DsBar_DpsiC
10880  *
10881  */
10882  __pyx_v_vBar2 = (__pyx_v_vBar * __pyx_v_vBar);
10883 
10884  /* "subsurfaceTransportFunctions.pyx":435
10885  * vBar = 1.0-pcBar_nM1*sBar
10886  * vBar2 = vBar*vBar
10887  * DvBar_DpsiC = -alpha[matID]*(n[matID]-1.0)*pcBar_nM2*sBar - pcBar_nM1*DsBar_DpsiC # <<<<<<<<<<<<<<
10888  *
10889  * thetaW = thetaSR[matID]*sBar + thetaR[matID]
10890  */
10891  __pyx_t_11 = __pyx_v_matID;
10892  __pyx_t_16 = -1;
10893  if (__pyx_t_11 < 0) {
10894  __pyx_t_11 += __pyx_pybuffernd_alpha.diminfo[0].shape;
10895  if (unlikely(__pyx_t_11 < 0)) __pyx_t_16 = 0;
10896  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_alpha.diminfo[0].shape)) __pyx_t_16 = 0;
10897  if (unlikely(__pyx_t_16 != -1)) {
10898  __Pyx_RaiseBufferIndexError(__pyx_t_16);
10899  __PYX_ERR(0, 435, __pyx_L1_error)
10900  }
10901  __pyx_t_15 = __pyx_v_matID;
10902  __pyx_t_16 = -1;
10903  if (__pyx_t_15 < 0) {
10904  __pyx_t_15 += __pyx_pybuffernd_n.diminfo[0].shape;
10905  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 0;
10906  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_n.diminfo[0].shape)) __pyx_t_16 = 0;
10907  if (unlikely(__pyx_t_16 != -1)) {
10908  __Pyx_RaiseBufferIndexError(__pyx_t_16);
10909  __PYX_ERR(0, 435, __pyx_L1_error)
10910  }
10911  __pyx_v_DvBar_DpsiC = (((((-(*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_alpha.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_alpha.diminfo[0].strides))) * ((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_n.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_n.diminfo[0].strides)) - 1.0)) * __pyx_v_pcBar_nM2) * __pyx_v_sBar) - (__pyx_v_pcBar_nM1 * __pyx_v_DsBar_DpsiC));
10912 
10913  /* "subsurfaceTransportFunctions.pyx":437
10914  * DvBar_DpsiC = -alpha[matID]*(n[matID]-1.0)*pcBar_nM2*sBar - pcBar_nM1*DsBar_DpsiC
10915  *
10916  * thetaW = thetaSR[matID]*sBar + thetaR[matID] # <<<<<<<<<<<<<<
10917  * DthetaW_DpsiC = thetaSR[matID] * DsBar_DpsiC
10918  *
10919  */
10920  __pyx_t_15 = __pyx_v_matID;
10921  __pyx_t_16 = -1;
10922  if (__pyx_t_15 < 0) {
10923  __pyx_t_15 += __pyx_pybuffernd_thetaSR.diminfo[0].shape;
10924  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 0;
10925  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_thetaSR.diminfo[0].shape)) __pyx_t_16 = 0;
10926  if (unlikely(__pyx_t_16 != -1)) {
10927  __Pyx_RaiseBufferIndexError(__pyx_t_16);
10928  __PYX_ERR(0, 437, __pyx_L1_error)
10929  }
10930  __pyx_t_11 = __pyx_v_matID;
10931  __pyx_t_16 = -1;
10932  if (__pyx_t_11 < 0) {
10933  __pyx_t_11 += __pyx_pybuffernd_thetaR.diminfo[0].shape;
10934  if (unlikely(__pyx_t_11 < 0)) __pyx_t_16 = 0;
10935  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_thetaR.diminfo[0].shape)) __pyx_t_16 = 0;
10936  if (unlikely(__pyx_t_16 != -1)) {
10937  __Pyx_RaiseBufferIndexError(__pyx_t_16);
10938  __PYX_ERR(0, 437, __pyx_L1_error)
10939  }
10940  __pyx_v_thetaW = (((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_thetaSR.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_thetaSR.diminfo[0].strides)) * __pyx_v_sBar) + (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_thetaR.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_thetaR.diminfo[0].strides)));
10941 
10942  /* "subsurfaceTransportFunctions.pyx":438
10943  *
10944  * thetaW = thetaSR[matID]*sBar + thetaR[matID]
10945  * DthetaW_DpsiC = thetaSR[matID] * DsBar_DpsiC # <<<<<<<<<<<<<<
10946  *
10947  * sqrt_sBar = sqrt(sBar)
10948  */
10949  __pyx_t_11 = __pyx_v_matID;
10950  __pyx_t_16 = -1;
10951  if (__pyx_t_11 < 0) {
10952  __pyx_t_11 += __pyx_pybuffernd_thetaSR.diminfo[0].shape;
10953  if (unlikely(__pyx_t_11 < 0)) __pyx_t_16 = 0;
10954  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_thetaSR.diminfo[0].shape)) __pyx_t_16 = 0;
10955  if (unlikely(__pyx_t_16 != -1)) {
10956  __Pyx_RaiseBufferIndexError(__pyx_t_16);
10957  __PYX_ERR(0, 438, __pyx_L1_error)
10958  }
10959  __pyx_v_DthetaW_DpsiC = ((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_thetaSR.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_thetaSR.diminfo[0].strides)) * __pyx_v_DsBar_DpsiC);
10960 
10961  /* "subsurfaceTransportFunctions.pyx":440
10962  * DthetaW_DpsiC = thetaSR[matID] * DsBar_DpsiC
10963  *
10964  * sqrt_sBar = sqrt(sBar) # <<<<<<<<<<<<<<
10965  * KWr= sqrt_sBar*vBar2
10966  * DKWr_DpsiC= ((0.5/sqrt_sBar)*DsBar_DpsiC*vBar2 + 2.0*sqrt_sBar*vBar*DvBar_DpsiC)
10967  */
10968  __pyx_v_sqrt_sBar = sqrt(__pyx_v_sBar);
10969 
10970  /* "subsurfaceTransportFunctions.pyx":441
10971  *
10972  * sqrt_sBar = sqrt(sBar)
10973  * KWr= sqrt_sBar*vBar2 # <<<<<<<<<<<<<<
10974  * DKWr_DpsiC= ((0.5/sqrt_sBar)*DsBar_DpsiC*vBar2 + 2.0*sqrt_sBar*vBar*DvBar_DpsiC)
10975  * else:
10976  */
10977  __pyx_v_KWr = (__pyx_v_sqrt_sBar * __pyx_v_vBar2);
10978 
10979  /* "subsurfaceTransportFunctions.pyx":442
10980  * sqrt_sBar = sqrt(sBar)
10981  * KWr= sqrt_sBar*vBar2
10982  * DKWr_DpsiC= ((0.5/sqrt_sBar)*DsBar_DpsiC*vBar2 + 2.0*sqrt_sBar*vBar*DvBar_DpsiC) # <<<<<<<<<<<<<<
10983  * else:
10984  * thetaW = thetaS
10985  */
10986  if (unlikely(__pyx_v_sqrt_sBar == 0)) {
10987  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
10988  __PYX_ERR(0, 442, __pyx_L1_error)
10989  }
10990  __pyx_v_DKWr_DpsiC = ((((0.5 / __pyx_v_sqrt_sBar) * __pyx_v_DsBar_DpsiC) * __pyx_v_vBar2) + (((2.0 * __pyx_v_sqrt_sBar) * __pyx_v_vBar) * __pyx_v_DvBar_DpsiC));
10991 
10992  /* "subsurfaceTransportFunctions.pyx":422
10993  * m = 1.0 - 1.0/n[matID]
10994  * thetaS = thetaR[matID] + thetaSR[matID]
10995  * if psiC > 0.0: # <<<<<<<<<<<<<<
10996  * pcBar = alpha[matID]*psiC
10997  * pcBar_nM2 = pow(pcBar,n[matID]-2)
10998  */
10999  goto __pyx_L9;
11000  }
11001 
11002  /* "subsurfaceTransportFunctions.pyx":444
11003  * DKWr_DpsiC= ((0.5/sqrt_sBar)*DsBar_DpsiC*vBar2 + 2.0*sqrt_sBar*vBar*DvBar_DpsiC)
11004  * else:
11005  * thetaW = thetaS # <<<<<<<<<<<<<<
11006  * DthetaW_DpsiC = 0.0
11007  * KWr = 1.0
11008  */
11009  /*else*/ {
11010  __pyx_v_thetaW = __pyx_v_thetaS;
11011 
11012  /* "subsurfaceTransportFunctions.pyx":445
11013  * else:
11014  * thetaW = thetaS
11015  * DthetaW_DpsiC = 0.0 # <<<<<<<<<<<<<<
11016  * KWr = 1.0
11017  * DKWr_DpsiC = 0.0
11018  */
11019  __pyx_v_DthetaW_DpsiC = 0.0;
11020 
11021  /* "subsurfaceTransportFunctions.pyx":446
11022  * thetaW = thetaS
11023  * DthetaW_DpsiC = 0.0
11024  * KWr = 1.0 # <<<<<<<<<<<<<<
11025  * DKWr_DpsiC = 0.0
11026  * #
11027  */
11028  __pyx_v_KWr = 1.0;
11029 
11030  /* "subsurfaceTransportFunctions.pyx":447
11031  * DthetaW_DpsiC = 0.0
11032  * KWr = 1.0
11033  * DKWr_DpsiC = 0.0 # <<<<<<<<<<<<<<
11034  * #
11035  * rhom = rho*exp(beta*u_j)
11036  */
11037  __pyx_v_DKWr_DpsiC = 0.0;
11038  }
11039  __pyx_L9:;
11040 
11041  /* "subsurfaceTransportFunctions.pyx":449
11042  * DKWr_DpsiC = 0.0
11043  * #
11044  * rhom = rho*exp(beta*u_j) # <<<<<<<<<<<<<<
11045  * drhom= beta*rhom
11046  * q_mass[eN,j] = rhom*thetaW
11047  */
11048  __pyx_v_rhom = (__pyx_v_rho * exp((__pyx_v_beta * __pyx_v_u_j)));
11049 
11050  /* "subsurfaceTransportFunctions.pyx":450
11051  * #
11052  * rhom = rho*exp(beta*u_j)
11053  * drhom= beta*rhom # <<<<<<<<<<<<<<
11054  * q_mass[eN,j] = rhom*thetaW
11055  * q_dmass[eN,j]=-rhom*DthetaW_DpsiC+drhom*thetaW
11056  */
11057  __pyx_v_drhom = (__pyx_v_beta * __pyx_v_rhom);
11058 
11059  /* "subsurfaceTransportFunctions.pyx":451
11060  * rhom = rho*exp(beta*u_j)
11061  * drhom= beta*rhom
11062  * q_mass[eN,j] = rhom*thetaW # <<<<<<<<<<<<<<
11063  * q_dmass[eN,j]=-rhom*DthetaW_DpsiC+drhom*thetaW
11064  *
11065  */
11066  __pyx_t_11 = __pyx_v_eN;
11067  __pyx_t_15 = __pyx_v_j;
11068  __pyx_t_16 = -1;
11069  if (__pyx_t_11 < 0) {
11070  __pyx_t_11 += __pyx_pybuffernd_q_mass.diminfo[0].shape;
11071  if (unlikely(__pyx_t_11 < 0)) __pyx_t_16 = 0;
11072  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_q_mass.diminfo[0].shape)) __pyx_t_16 = 0;
11073  if (__pyx_t_15 < 0) {
11074  __pyx_t_15 += __pyx_pybuffernd_q_mass.diminfo[1].shape;
11075  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 1;
11076  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_mass.diminfo[1].shape)) __pyx_t_16 = 1;
11077  if (unlikely(__pyx_t_16 != -1)) {
11078  __Pyx_RaiseBufferIndexError(__pyx_t_16);
11079  __PYX_ERR(0, 451, __pyx_L1_error)
11080  }
11081  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_mass.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_q_mass.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_q_mass.diminfo[1].strides) = (__pyx_v_rhom * __pyx_v_thetaW);
11082 
11083  /* "subsurfaceTransportFunctions.pyx":452
11084  * drhom= beta*rhom
11085  * q_mass[eN,j] = rhom*thetaW
11086  * q_dmass[eN,j]=-rhom*DthetaW_DpsiC+drhom*thetaW # <<<<<<<<<<<<<<
11087  *
11088  * q_kr[eN,j] = KWr
11089  */
11090  __pyx_t_15 = __pyx_v_eN;
11091  __pyx_t_11 = __pyx_v_j;
11092  __pyx_t_16 = -1;
11093  if (__pyx_t_15 < 0) {
11094  __pyx_t_15 += __pyx_pybuffernd_q_dmass.diminfo[0].shape;
11095  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 0;
11096  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_dmass.diminfo[0].shape)) __pyx_t_16 = 0;
11097  if (__pyx_t_11 < 0) {
11098  __pyx_t_11 += __pyx_pybuffernd_q_dmass.diminfo[1].shape;
11099  if (unlikely(__pyx_t_11 < 0)) __pyx_t_16 = 1;
11100  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_q_dmass.diminfo[1].shape)) __pyx_t_16 = 1;
11101  if (unlikely(__pyx_t_16 != -1)) {
11102  __Pyx_RaiseBufferIndexError(__pyx_t_16);
11103  __PYX_ERR(0, 452, __pyx_L1_error)
11104  }
11105  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_dmass.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_q_dmass.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_q_dmass.diminfo[1].strides) = (((-__pyx_v_rhom) * __pyx_v_DthetaW_DpsiC) + (__pyx_v_drhom * __pyx_v_thetaW));
11106 
11107  /* "subsurfaceTransportFunctions.pyx":454
11108  * q_dmass[eN,j]=-rhom*DthetaW_DpsiC+drhom*thetaW
11109  *
11110  * q_kr[eN,j] = KWr # <<<<<<<<<<<<<<
11111  * q_dkr[eN,j]= -DKWr_DpsiC
11112  *
11113  */
11114  __pyx_t_11 = __pyx_v_eN;
11115  __pyx_t_15 = __pyx_v_j;
11116  __pyx_t_16 = -1;
11117  if (__pyx_t_11 < 0) {
11118  __pyx_t_11 += __pyx_pybuffernd_q_kr.diminfo[0].shape;
11119  if (unlikely(__pyx_t_11 < 0)) __pyx_t_16 = 0;
11120  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_q_kr.diminfo[0].shape)) __pyx_t_16 = 0;
11121  if (__pyx_t_15 < 0) {
11122  __pyx_t_15 += __pyx_pybuffernd_q_kr.diminfo[1].shape;
11123  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 1;
11124  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_kr.diminfo[1].shape)) __pyx_t_16 = 1;
11125  if (unlikely(__pyx_t_16 != -1)) {
11126  __Pyx_RaiseBufferIndexError(__pyx_t_16);
11127  __PYX_ERR(0, 454, __pyx_L1_error)
11128  }
11129  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_q_kr.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_q_kr.diminfo[1].strides) = __pyx_v_KWr;
11130 
11131  /* "subsurfaceTransportFunctions.pyx":455
11132  *
11133  * q_kr[eN,j] = KWr
11134  * q_dkr[eN,j]= -DKWr_DpsiC # <<<<<<<<<<<<<<
11135  *
11136  * #j
11137  */
11138  __pyx_t_15 = __pyx_v_eN;
11139  __pyx_t_11 = __pyx_v_j;
11140  __pyx_t_16 = -1;
11141  if (__pyx_t_15 < 0) {
11142  __pyx_t_15 += __pyx_pybuffernd_q_dkr.diminfo[0].shape;
11143  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 0;
11144  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_dkr.diminfo[0].shape)) __pyx_t_16 = 0;
11145  if (__pyx_t_11 < 0) {
11146  __pyx_t_11 += __pyx_pybuffernd_q_dkr.diminfo[1].shape;
11147  if (unlikely(__pyx_t_11 < 0)) __pyx_t_16 = 1;
11148  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_q_dkr.diminfo[1].shape)) __pyx_t_16 = 1;
11149  if (unlikely(__pyx_t_16 != -1)) {
11150  __Pyx_RaiseBufferIndexError(__pyx_t_16);
11151  __PYX_ERR(0, 455, __pyx_L1_error)
11152  }
11153  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_q_dkr.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_q_dkr.diminfo[1].strides) = (-__pyx_v_DKWr_DpsiC);
11154  }
11155  }
11156 
11157  /* "subsurfaceTransportFunctions.pyx":461
11158  *
11159  * #now upwind kr
11160  * for eN in range(nElements_global): # <<<<<<<<<<<<<<
11161  * u_eN = numpy.sum(q_u[eN])*nAvgWeight
11162  * kr_eN = numpy.sum(q_kr[eN])*nAvgWeight
11163  */
11164  __pyx_t_8 = __pyx_v_nElements_global;
11165  __pyx_t_9 = __pyx_t_8;
11166  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
11167  __pyx_v_eN = __pyx_t_10;
11168 
11169  /* "subsurfaceTransportFunctions.pyx":462
11170  * #now upwind kr
11171  * for eN in range(nElements_global):
11172  * u_eN = numpy.sum(q_u[eN])*nAvgWeight # <<<<<<<<<<<<<<
11173  * kr_eN = numpy.sum(q_kr[eN])*nAvgWeight
11174  * #potential assumes slight compressibility
11175  */
11176  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_numpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 462, __pyx_L1_error)
11177  __Pyx_GOTREF(__pyx_t_5);
11178  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_sum); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 462, __pyx_L1_error)
11179  __Pyx_GOTREF(__pyx_t_1);
11180  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11181  __pyx_t_5 = __Pyx_GetItemInt(((PyObject *)__pyx_v_q_u), __pyx_v_eN, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 462, __pyx_L1_error)
11182  __Pyx_GOTREF(__pyx_t_5);
11183  __pyx_t_4 = NULL;
11184  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
11185  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
11186  if (likely(__pyx_t_4)) {
11187  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
11188  __Pyx_INCREF(__pyx_t_4);
11189  __Pyx_INCREF(function);
11190  __Pyx_DECREF_SET(__pyx_t_1, function);
11191  }
11192  }
11193  __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5);
11194  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
11195  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11196  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 462, __pyx_L1_error)
11197  __Pyx_GOTREF(__pyx_t_2);
11198  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11199  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_nAvgWeight); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 462, __pyx_L1_error)
11200  __Pyx_GOTREF(__pyx_t_1);
11201  __pyx_t_5 = PyNumber_Multiply(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 462, __pyx_L1_error)
11202  __Pyx_GOTREF(__pyx_t_5);
11203  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11204  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11205  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 462, __pyx_L1_error)
11206  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11207  __pyx_v_u_eN = __pyx_t_7;
11208 
11209  /* "subsurfaceTransportFunctions.pyx":463
11210  * for eN in range(nElements_global):
11211  * u_eN = numpy.sum(q_u[eN])*nAvgWeight
11212  * kr_eN = numpy.sum(q_kr[eN])*nAvgWeight # <<<<<<<<<<<<<<
11213  * #potential assumes slight compressibility
11214  * phi_eN= u_eN - numpy.dot(gravity,elementBarycentersArray[eN])
11215  */
11216  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 463, __pyx_L1_error)
11217  __Pyx_GOTREF(__pyx_t_1);
11218  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_sum); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 463, __pyx_L1_error)
11219  __Pyx_GOTREF(__pyx_t_2);
11220  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11221  __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_q_kr), __pyx_v_eN, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 463, __pyx_L1_error)
11222  __Pyx_GOTREF(__pyx_t_1);
11223  __pyx_t_4 = NULL;
11224  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
11225  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
11226  if (likely(__pyx_t_4)) {
11227  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
11228  __Pyx_INCREF(__pyx_t_4);
11229  __Pyx_INCREF(function);
11230  __Pyx_DECREF_SET(__pyx_t_2, function);
11231  }
11232  }
11233  __pyx_t_5 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1);
11234  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
11235  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11236  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 463, __pyx_L1_error)
11237  __Pyx_GOTREF(__pyx_t_5);
11238  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11239  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_nAvgWeight); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 463, __pyx_L1_error)
11240  __Pyx_GOTREF(__pyx_t_2);
11241  __pyx_t_1 = PyNumber_Multiply(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 463, __pyx_L1_error)
11242  __Pyx_GOTREF(__pyx_t_1);
11243  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11244  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11245  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 463, __pyx_L1_error)
11246  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11247  __pyx_v_kr_eN = __pyx_t_7;
11248 
11249  /* "subsurfaceTransportFunctions.pyx":465
11250  * kr_eN = numpy.sum(q_kr[eN])*nAvgWeight
11251  * #potential assumes slight compressibility
11252  * phi_eN= u_eN - numpy.dot(gravity,elementBarycentersArray[eN]) # <<<<<<<<<<<<<<
11253  *
11254  *
11255  */
11256  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_u_eN); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 465, __pyx_L1_error)
11257  __Pyx_GOTREF(__pyx_t_1);
11258  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_numpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 465, __pyx_L1_error)
11259  __Pyx_GOTREF(__pyx_t_5);
11260  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_dot); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 465, __pyx_L1_error)
11261  __Pyx_GOTREF(__pyx_t_4);
11262  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11263  __pyx_t_5 = __Pyx_GetItemInt(((PyObject *)__pyx_v_elementBarycentersArray), __pyx_v_eN, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 465, __pyx_L1_error)
11264  __Pyx_GOTREF(__pyx_t_5);
11265  __pyx_t_19 = NULL;
11266  __pyx_t_12 = 0;
11267  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
11268  __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_4);
11269  if (likely(__pyx_t_19)) {
11270  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
11271  __Pyx_INCREF(__pyx_t_19);
11272  __Pyx_INCREF(function);
11273  __Pyx_DECREF_SET(__pyx_t_4, function);
11274  __pyx_t_12 = 1;
11275  }
11276  }
11277  #if CYTHON_FAST_PYCALL
11278  if (PyFunction_Check(__pyx_t_4)) {
11279  PyObject *__pyx_temp[3] = {__pyx_t_19, ((PyObject *)__pyx_v_gravity), __pyx_t_5};
11280  __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 465, __pyx_L1_error)
11281  __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
11282  __Pyx_GOTREF(__pyx_t_2);
11283  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11284  } else
11285  #endif
11286  #if CYTHON_FAST_PYCCALL
11287  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
11288  PyObject *__pyx_temp[3] = {__pyx_t_19, ((PyObject *)__pyx_v_gravity), __pyx_t_5};
11289  __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 465, __pyx_L1_error)
11290  __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
11291  __Pyx_GOTREF(__pyx_t_2);
11292  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11293  } else
11294  #endif
11295  {
11296  __pyx_t_20 = PyTuple_New(2+__pyx_t_12); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 465, __pyx_L1_error)
11297  __Pyx_GOTREF(__pyx_t_20);
11298  if (__pyx_t_19) {
11299  __Pyx_GIVEREF(__pyx_t_19); PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_19); __pyx_t_19 = NULL;
11300  }
11301  __Pyx_INCREF(((PyObject *)__pyx_v_gravity));
11302  __Pyx_GIVEREF(((PyObject *)__pyx_v_gravity));
11303  PyTuple_SET_ITEM(__pyx_t_20, 0+__pyx_t_12, ((PyObject *)__pyx_v_gravity));
11304  __Pyx_GIVEREF(__pyx_t_5);
11305  PyTuple_SET_ITEM(__pyx_t_20, 1+__pyx_t_12, __pyx_t_5);
11306  __pyx_t_5 = 0;
11307  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_20, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 465, __pyx_L1_error)
11308  __Pyx_GOTREF(__pyx_t_2);
11309  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
11310  }
11311  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11312  __pyx_t_4 = PyNumber_Subtract(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 465, __pyx_L1_error)
11313  __Pyx_GOTREF(__pyx_t_4);
11314  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11315  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11316  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 465, __pyx_L1_error)
11317  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11318  __pyx_v_phi_eN = __pyx_t_7;
11319 
11320  /* "subsurfaceTransportFunctions.pyx":469
11321  *
11322  * #loop over faces to upwind
11323  * for ebN in range(nElementBoundaries_element): # <<<<<<<<<<<<<<
11324  * #by default eN is upwind
11325  * q_kr_up[eN,ebN] = kr_eN
11326  */
11327  __pyx_t_12 = __pyx_v_nElementBoundaries_element;
11328  __pyx_t_13 = __pyx_t_12;
11329  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
11330  __pyx_v_ebN = __pyx_t_14;
11331 
11332  /* "subsurfaceTransportFunctions.pyx":471
11333  * for ebN in range(nElementBoundaries_element):
11334  * #by default eN is upwind
11335  * q_kr_up[eN,ebN] = kr_eN # <<<<<<<<<<<<<<
11336  * eN_neighbor = elementNeighborsArray[eN,ebN]
11337  * if eN_neighbor >= 0:
11338  */
11339  __pyx_t_11 = __pyx_v_eN;
11340  __pyx_t_15 = __pyx_v_ebN;
11341  __pyx_t_16 = -1;
11342  if (__pyx_t_11 < 0) {
11343  __pyx_t_11 += __pyx_pybuffernd_q_kr_up.diminfo[0].shape;
11344  if (unlikely(__pyx_t_11 < 0)) __pyx_t_16 = 0;
11345  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_q_kr_up.diminfo[0].shape)) __pyx_t_16 = 0;
11346  if (__pyx_t_15 < 0) {
11347  __pyx_t_15 += __pyx_pybuffernd_q_kr_up.diminfo[1].shape;
11348  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 1;
11349  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_kr_up.diminfo[1].shape)) __pyx_t_16 = 1;
11350  if (unlikely(__pyx_t_16 != -1)) {
11351  __Pyx_RaiseBufferIndexError(__pyx_t_16);
11352  __PYX_ERR(0, 471, __pyx_L1_error)
11353  }
11354  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_q_kr_up.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_q_kr_up.diminfo[1].strides) = __pyx_v_kr_eN;
11355 
11356  /* "subsurfaceTransportFunctions.pyx":472
11357  * #by default eN is upwind
11358  * q_kr_up[eN,ebN] = kr_eN
11359  * eN_neighbor = elementNeighborsArray[eN,ebN] # <<<<<<<<<<<<<<
11360  * if eN_neighbor >= 0:
11361  * u_neig = numpy.sum(q_u[eN_neighbor])*nAvgWeight
11362  */
11363  __pyx_t_15 = __pyx_v_eN;
11364  __pyx_t_11 = __pyx_v_ebN;
11365  __pyx_t_16 = -1;
11366  if (__pyx_t_15 < 0) {
11367  __pyx_t_15 += __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape;
11368  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 0;
11369  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape)) __pyx_t_16 = 0;
11370  if (__pyx_t_11 < 0) {
11371  __pyx_t_11 += __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape;
11372  if (unlikely(__pyx_t_11 < 0)) __pyx_t_16 = 1;
11373  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape)) __pyx_t_16 = 1;
11374  if (unlikely(__pyx_t_16 != -1)) {
11375  __Pyx_RaiseBufferIndexError(__pyx_t_16);
11376  __PYX_ERR(0, 472, __pyx_L1_error)
11377  }
11378  __pyx_v_eN_neighbor = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_elementNeighborsArray.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_elementNeighborsArray.diminfo[1].strides));
11379 
11380  /* "subsurfaceTransportFunctions.pyx":473
11381  * q_kr_up[eN,ebN] = kr_eN
11382  * eN_neighbor = elementNeighborsArray[eN,ebN]
11383  * if eN_neighbor >= 0: # <<<<<<<<<<<<<<
11384  * u_neig = numpy.sum(q_u[eN_neighbor])*nAvgWeight
11385  * kr_neig = numpy.sum(q_kr[eN_neighbor])*nAvgWeight
11386  */
11387  __pyx_t_6 = ((__pyx_v_eN_neighbor >= 0) != 0);
11388  if (__pyx_t_6) {
11389 
11390  /* "subsurfaceTransportFunctions.pyx":474
11391  * eN_neighbor = elementNeighborsArray[eN,ebN]
11392  * if eN_neighbor >= 0:
11393  * u_neig = numpy.sum(q_u[eN_neighbor])*nAvgWeight # <<<<<<<<<<<<<<
11394  * kr_neig = numpy.sum(q_kr[eN_neighbor])*nAvgWeight
11395  * #potential, assumes slight compressibility
11396  */
11397  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 474, __pyx_L1_error)
11398  __Pyx_GOTREF(__pyx_t_2);
11399  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sum); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 474, __pyx_L1_error)
11400  __Pyx_GOTREF(__pyx_t_1);
11401  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11402  __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_q_u), __pyx_v_eN_neighbor, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 474, __pyx_L1_error)
11403  __Pyx_GOTREF(__pyx_t_2);
11404  __pyx_t_20 = NULL;
11405  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
11406  __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_1);
11407  if (likely(__pyx_t_20)) {
11408  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
11409  __Pyx_INCREF(__pyx_t_20);
11410  __Pyx_INCREF(function);
11411  __Pyx_DECREF_SET(__pyx_t_1, function);
11412  }
11413  }
11414  __pyx_t_4 = (__pyx_t_20) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_20, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2);
11415  __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
11416  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11417  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 474, __pyx_L1_error)
11418  __Pyx_GOTREF(__pyx_t_4);
11419  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11420  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_nAvgWeight); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 474, __pyx_L1_error)
11421  __Pyx_GOTREF(__pyx_t_1);
11422  __pyx_t_2 = PyNumber_Multiply(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 474, __pyx_L1_error)
11423  __Pyx_GOTREF(__pyx_t_2);
11424  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11425  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11426  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 474, __pyx_L1_error)
11427  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11428  __pyx_v_u_neig = __pyx_t_7;
11429 
11430  /* "subsurfaceTransportFunctions.pyx":475
11431  * if eN_neighbor >= 0:
11432  * u_neig = numpy.sum(q_u[eN_neighbor])*nAvgWeight
11433  * kr_neig = numpy.sum(q_kr[eN_neighbor])*nAvgWeight # <<<<<<<<<<<<<<
11434  * #potential, assumes slight compressibility
11435  * phi_neig= u_neig - numpy.dot(gravity,elementBarycentersArray[eN_neighbor])
11436  */
11437  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 475, __pyx_L1_error)
11438  __Pyx_GOTREF(__pyx_t_1);
11439  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_sum); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 475, __pyx_L1_error)
11440  __Pyx_GOTREF(__pyx_t_4);
11441  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11442  __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_q_kr), __pyx_v_eN_neighbor, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 475, __pyx_L1_error)
11443  __Pyx_GOTREF(__pyx_t_1);
11444  __pyx_t_20 = NULL;
11445  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
11446  __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_4);
11447  if (likely(__pyx_t_20)) {
11448  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
11449  __Pyx_INCREF(__pyx_t_20);
11450  __Pyx_INCREF(function);
11451  __Pyx_DECREF_SET(__pyx_t_4, function);
11452  }
11453  }
11454  __pyx_t_2 = (__pyx_t_20) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_20, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_1);
11455  __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
11456  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11457  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 475, __pyx_L1_error)
11458  __Pyx_GOTREF(__pyx_t_2);
11459  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11460  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_nAvgWeight); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 475, __pyx_L1_error)
11461  __Pyx_GOTREF(__pyx_t_4);
11462  __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 475, __pyx_L1_error)
11463  __Pyx_GOTREF(__pyx_t_1);
11464  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11465  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11466  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 475, __pyx_L1_error)
11467  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11468  __pyx_v_kr_neig = __pyx_t_7;
11469 
11470  /* "subsurfaceTransportFunctions.pyx":477
11471  * kr_neig = numpy.sum(q_kr[eN_neighbor])*nAvgWeight
11472  * #potential, assumes slight compressibility
11473  * phi_neig= u_neig - numpy.dot(gravity,elementBarycentersArray[eN_neighbor]) # <<<<<<<<<<<<<<
11474  *
11475  * if phi_eN < phi_neig: #neighbor is upwind
11476  */
11477  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_u_neig); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 477, __pyx_L1_error)
11478  __Pyx_GOTREF(__pyx_t_1);
11479  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 477, __pyx_L1_error)
11480  __Pyx_GOTREF(__pyx_t_2);
11481  __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_dot); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 477, __pyx_L1_error)
11482  __Pyx_GOTREF(__pyx_t_20);
11483  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11484  __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_elementBarycentersArray), __pyx_v_eN_neighbor, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 477, __pyx_L1_error)
11485  __Pyx_GOTREF(__pyx_t_2);
11486  __pyx_t_5 = NULL;
11487  __pyx_t_16 = 0;
11488  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_20))) {
11489  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_20);
11490  if (likely(__pyx_t_5)) {
11491  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_20);
11492  __Pyx_INCREF(__pyx_t_5);
11493  __Pyx_INCREF(function);
11494  __Pyx_DECREF_SET(__pyx_t_20, function);
11495  __pyx_t_16 = 1;
11496  }
11497  }
11498  #if CYTHON_FAST_PYCALL
11499  if (PyFunction_Check(__pyx_t_20)) {
11500  PyObject *__pyx_temp[3] = {__pyx_t_5, ((PyObject *)__pyx_v_gravity), __pyx_t_2};
11501  __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_20, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 477, __pyx_L1_error)
11502  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
11503  __Pyx_GOTREF(__pyx_t_4);
11504  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11505  } else
11506  #endif
11507  #if CYTHON_FAST_PYCCALL
11508  if (__Pyx_PyFastCFunction_Check(__pyx_t_20)) {
11509  PyObject *__pyx_temp[3] = {__pyx_t_5, ((PyObject *)__pyx_v_gravity), __pyx_t_2};
11510  __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_20, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 477, __pyx_L1_error)
11511  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
11512  __Pyx_GOTREF(__pyx_t_4);
11513  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11514  } else
11515  #endif
11516  {
11517  __pyx_t_19 = PyTuple_New(2+__pyx_t_16); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 477, __pyx_L1_error)
11518  __Pyx_GOTREF(__pyx_t_19);
11519  if (__pyx_t_5) {
11520  __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_5); __pyx_t_5 = NULL;
11521  }
11522  __Pyx_INCREF(((PyObject *)__pyx_v_gravity));
11523  __Pyx_GIVEREF(((PyObject *)__pyx_v_gravity));
11524  PyTuple_SET_ITEM(__pyx_t_19, 0+__pyx_t_16, ((PyObject *)__pyx_v_gravity));
11525  __Pyx_GIVEREF(__pyx_t_2);
11526  PyTuple_SET_ITEM(__pyx_t_19, 1+__pyx_t_16, __pyx_t_2);
11527  __pyx_t_2 = 0;
11528  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_20, __pyx_t_19, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 477, __pyx_L1_error)
11529  __Pyx_GOTREF(__pyx_t_4);
11530  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
11531  }
11532  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
11533  __pyx_t_20 = PyNumber_Subtract(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 477, __pyx_L1_error)
11534  __Pyx_GOTREF(__pyx_t_20);
11535  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11536  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11537  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_20); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 477, __pyx_L1_error)
11538  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
11539  __pyx_v_phi_neig = __pyx_t_7;
11540 
11541  /* "subsurfaceTransportFunctions.pyx":479
11542  * phi_neig= u_neig - numpy.dot(gravity,elementBarycentersArray[eN_neighbor])
11543  *
11544  * if phi_eN < phi_neig: #neighbor is upwind # <<<<<<<<<<<<<<
11545  * q_kr_up[eN,ebN] = kr_neig
11546  *
11547  */
11548  __pyx_t_6 = ((__pyx_v_phi_eN < __pyx_v_phi_neig) != 0);
11549  if (__pyx_t_6) {
11550 
11551  /* "subsurfaceTransportFunctions.pyx":480
11552  *
11553  * if phi_eN < phi_neig: #neighbor is upwind
11554  * q_kr_up[eN,ebN] = kr_neig # <<<<<<<<<<<<<<
11555  *
11556  * #neighbor
11557  */
11558  __pyx_t_11 = __pyx_v_eN;
11559  __pyx_t_15 = __pyx_v_ebN;
11560  __pyx_t_16 = -1;
11561  if (__pyx_t_11 < 0) {
11562  __pyx_t_11 += __pyx_pybuffernd_q_kr_up.diminfo[0].shape;
11563  if (unlikely(__pyx_t_11 < 0)) __pyx_t_16 = 0;
11564  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_q_kr_up.diminfo[0].shape)) __pyx_t_16 = 0;
11565  if (__pyx_t_15 < 0) {
11566  __pyx_t_15 += __pyx_pybuffernd_q_kr_up.diminfo[1].shape;
11567  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 1;
11568  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_kr_up.diminfo[1].shape)) __pyx_t_16 = 1;
11569  if (unlikely(__pyx_t_16 != -1)) {
11570  __Pyx_RaiseBufferIndexError(__pyx_t_16);
11571  __PYX_ERR(0, 480, __pyx_L1_error)
11572  }
11573  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_q_kr_up.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_q_kr_up.diminfo[1].strides) = __pyx_v_kr_neig;
11574 
11575  /* "subsurfaceTransportFunctions.pyx":479
11576  * phi_neig= u_neig - numpy.dot(gravity,elementBarycentersArray[eN_neighbor])
11577  *
11578  * if phi_eN < phi_neig: #neighbor is upwind # <<<<<<<<<<<<<<
11579  * q_kr_up[eN,ebN] = kr_neig
11580  *
11581  */
11582  }
11583 
11584  /* "subsurfaceTransportFunctions.pyx":473
11585  * q_kr_up[eN,ebN] = kr_eN
11586  * eN_neighbor = elementNeighborsArray[eN,ebN]
11587  * if eN_neighbor >= 0: # <<<<<<<<<<<<<<
11588  * u_neig = numpy.sum(q_u[eN_neighbor])*nAvgWeight
11589  * kr_neig = numpy.sum(q_kr[eN_neighbor])*nAvgWeight
11590  */
11591  }
11592  }
11593  }
11594 
11595  /* "subsurfaceTransportFunctions.pyx":359
11596  *
11597  *
11598  * def RE_NCP1_evaluateElementCoefficients_VGM(double rho, # <<<<<<<<<<<<<<
11599  * double beta,
11600  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
11601  */
11602 
11603  /* function exit code */
11604  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
11605  goto __pyx_L0;
11606  __pyx_L1_error:;
11607  __Pyx_XDECREF(__pyx_t_1);
11608  __Pyx_XDECREF(__pyx_t_2);
11609  __Pyx_XDECREF(__pyx_t_4);
11610  __Pyx_XDECREF(__pyx_t_5);
11611  __Pyx_XDECREF(__pyx_t_19);
11612  __Pyx_XDECREF(__pyx_t_20);
11613  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
11614  __Pyx_PyThreadState_declare
11615  __Pyx_PyThreadState_assign
11616  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
11617  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alpha.rcbuffer->pybuffer);
11618  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer);
11619  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
11620  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
11621  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
11622  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_n.rcbuffer->pybuffer);
11623  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dkr.rcbuffer->pybuffer);
11624  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dmass.rcbuffer->pybuffer);
11625  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer);
11626  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer);
11627  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_mass.rcbuffer->pybuffer);
11628  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer);
11629  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer);
11630  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_x.rcbuffer->pybuffer);
11631  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_thetaR.rcbuffer->pybuffer);
11632  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_thetaSR.rcbuffer->pybuffer);
11633  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_u_dof.rcbuffer->pybuffer);
11634  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_u_l2g.rcbuffer->pybuffer);
11635  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
11636  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_evaluateElementCoefficients_VGM", __pyx_clineno, __pyx_lineno, __pyx_filename);
11637  __pyx_r = NULL;
11638  goto __pyx_L2;
11639  __pyx_L0:;
11640  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_alpha.rcbuffer->pybuffer);
11641  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer);
11642  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementMaterialTypes.rcbuffer->pybuffer);
11643  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
11644  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
11645  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_n.rcbuffer->pybuffer);
11646  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dkr.rcbuffer->pybuffer);
11647  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dmass.rcbuffer->pybuffer);
11648  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer);
11649  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer);
11650  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_mass.rcbuffer->pybuffer);
11651  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer);
11652  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer);
11653  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_x.rcbuffer->pybuffer);
11654  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_thetaR.rcbuffer->pybuffer);
11655  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_thetaSR.rcbuffer->pybuffer);
11656  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_u_dof.rcbuffer->pybuffer);
11657  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_u_l2g.rcbuffer->pybuffer);
11658  __pyx_L2:;
11659  __Pyx_XDECREF(__pyx_v_q);
11660  __Pyx_XGIVEREF(__pyx_r);
11661  __Pyx_RefNannyFinishContext();
11662  return __pyx_r;
11663 }
11664 
11665 /* "subsurfaceTransportFunctions.pyx":486
11666  * #eN for upwind
11667  *
11668  * def RE_NCP1_getElementResidual(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
11669  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
11670  * numpy.ndarray[ITYPE_t,ndim=1] colind,
11671  */
11672 
11673 /* Python wrapper */
11674 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_33RE_NCP1_getElementResidual(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
11675 static char __pyx_doc_28subsurfaceTransportFunctions_32RE_NCP1_getElementResidual[] = "\n residual routine for NCP1 approximation for conservative head formulation of Richards equation \n\n Approximation:\n uses nodal quadrature where the nodes are face barycenters\n uses harmonic average for intrinsic permeability/ hydraulic conductivity\n upwinds relative permeability based on element averages\n applies dirichlet boundary conditions strongly but keeps dofs in system\n\n TODO:\n everything\n \n ";
11676 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_33RE_NCP1_getElementResidual = {"RE_NCP1_getElementResidual", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_33RE_NCP1_getElementResidual, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_32RE_NCP1_getElementResidual};
11677 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_33RE_NCP1_getElementResidual(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
11678  CYTHON_UNUSED PyArrayObject *__pyx_v_gravity = 0;
11679  PyArrayObject *__pyx_v_rowptr = 0;
11680  PyArrayObject *__pyx_v_colind = 0;
11681  int __pyx_v_nSpace;
11682  int __pyx_v_nElements_global;
11683  int __pyx_v_nElementBoundaries_element;
11684  CYTHON_UNUSED PyArrayObject *__pyx_v_elementNeighborsArray = 0;
11685  CYTHON_UNUSED PyArrayObject *__pyx_v_elementBarycentersArray = 0;
11686  int __pyx_v_nDOF_test_element;
11687  PyArrayObject *__pyx_v_q_u = 0;
11688  PyArrayObject *__pyx_v_q_grad_u = 0;
11689  PyArrayObject *__pyx_v_q_grad_w = 0;
11690  PyArrayObject *__pyx_v_q_detJ = 0;
11691  PyArrayObject *__pyx_v_q_m = 0;
11692  PyArrayObject *__pyx_v_q_mt = 0;
11693  PyArrayObject *__pyx_v_q_r = 0;
11694  PyArrayObject *__pyx_v_q_kr = 0;
11695  PyArrayObject *__pyx_v_q_kr_up = 0;
11696  PyArrayObject *__pyx_v_q_flin = 0;
11697  PyArrayObject *__pyx_v_q_alin = 0;
11698  PyArrayObject *__pyx_v_elementResidual = 0;
11699  int __pyx_lineno = 0;
11700  const char *__pyx_filename = NULL;
11701  int __pyx_clineno = 0;
11702  PyObject *__pyx_r = 0;
11703  __Pyx_RefNannyDeclarations
11704  __Pyx_RefNannySetupContext("RE_NCP1_getElementResidual (wrapper)", 0);
11705  {
11706  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gravity,&__pyx_n_s_rowptr,&__pyx_n_s_colind,&__pyx_n_s_nSpace,&__pyx_n_s_nElements_global,&__pyx_n_s_nElementBoundaries_element,&__pyx_n_s_elementNeighborsArray,&__pyx_n_s_elementBarycentersArray,&__pyx_n_s_nDOF_test_element,&__pyx_n_s_q_u,&__pyx_n_s_q_grad_u,&__pyx_n_s_q_grad_w,&__pyx_n_s_q_detJ,&__pyx_n_s_q_m,&__pyx_n_s_q_mt,&__pyx_n_s_q_r,&__pyx_n_s_q_kr,&__pyx_n_s_q_kr_up,&__pyx_n_s_q_flin,&__pyx_n_s_q_alin,&__pyx_n_s_elementResidual,0};
11707  PyObject* values[21] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
11708  if (unlikely(__pyx_kwds)) {
11709  Py_ssize_t kw_args;
11710  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
11711  switch (pos_args) {
11712  case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
11713  CYTHON_FALLTHROUGH;
11714  case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
11715  CYTHON_FALLTHROUGH;
11716  case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
11717  CYTHON_FALLTHROUGH;
11718  case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
11719  CYTHON_FALLTHROUGH;
11720  case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
11721  CYTHON_FALLTHROUGH;
11722  case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
11723  CYTHON_FALLTHROUGH;
11724  case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
11725  CYTHON_FALLTHROUGH;
11726  case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
11727  CYTHON_FALLTHROUGH;
11728  case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
11729  CYTHON_FALLTHROUGH;
11730  case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
11731  CYTHON_FALLTHROUGH;
11732  case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
11733  CYTHON_FALLTHROUGH;
11734  case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
11735  CYTHON_FALLTHROUGH;
11736  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
11737  CYTHON_FALLTHROUGH;
11738  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
11739  CYTHON_FALLTHROUGH;
11740  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
11741  CYTHON_FALLTHROUGH;
11742  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
11743  CYTHON_FALLTHROUGH;
11744  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
11745  CYTHON_FALLTHROUGH;
11746  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
11747  CYTHON_FALLTHROUGH;
11748  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11749  CYTHON_FALLTHROUGH;
11750  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11751  CYTHON_FALLTHROUGH;
11752  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11753  CYTHON_FALLTHROUGH;
11754  case 0: break;
11755  default: goto __pyx_L5_argtuple_error;
11756  }
11757  kw_args = PyDict_Size(__pyx_kwds);
11758  switch (pos_args) {
11759  case 0:
11760  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gravity)) != 0)) kw_args--;
11761  else goto __pyx_L5_argtuple_error;
11762  CYTHON_FALLTHROUGH;
11763  case 1:
11764  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rowptr)) != 0)) kw_args--;
11765  else {
11766  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 1); __PYX_ERR(0, 486, __pyx_L3_error)
11767  }
11768  CYTHON_FALLTHROUGH;
11769  case 2:
11770  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_colind)) != 0)) kw_args--;
11771  else {
11772  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 2); __PYX_ERR(0, 486, __pyx_L3_error)
11773  }
11774  CYTHON_FALLTHROUGH;
11775  case 3:
11776  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nSpace)) != 0)) kw_args--;
11777  else {
11778  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 3); __PYX_ERR(0, 486, __pyx_L3_error)
11779  }
11780  CYTHON_FALLTHROUGH;
11781  case 4:
11782  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElements_global)) != 0)) kw_args--;
11783  else {
11784  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 4); __PYX_ERR(0, 486, __pyx_L3_error)
11785  }
11786  CYTHON_FALLTHROUGH;
11787  case 5:
11788  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElementBoundaries_element)) != 0)) kw_args--;
11789  else {
11790  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 5); __PYX_ERR(0, 486, __pyx_L3_error)
11791  }
11792  CYTHON_FALLTHROUGH;
11793  case 6:
11794  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementNeighborsArray)) != 0)) kw_args--;
11795  else {
11796  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 6); __PYX_ERR(0, 486, __pyx_L3_error)
11797  }
11798  CYTHON_FALLTHROUGH;
11799  case 7:
11800  if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBarycentersArray)) != 0)) kw_args--;
11801  else {
11802  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 7); __PYX_ERR(0, 486, __pyx_L3_error)
11803  }
11804  CYTHON_FALLTHROUGH;
11805  case 8:
11806  if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nDOF_test_element)) != 0)) kw_args--;
11807  else {
11808  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 8); __PYX_ERR(0, 486, __pyx_L3_error)
11809  }
11810  CYTHON_FALLTHROUGH;
11811  case 9:
11812  if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_u)) != 0)) kw_args--;
11813  else {
11814  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 9); __PYX_ERR(0, 486, __pyx_L3_error)
11815  }
11816  CYTHON_FALLTHROUGH;
11817  case 10:
11818  if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_grad_u)) != 0)) kw_args--;
11819  else {
11820  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 10); __PYX_ERR(0, 486, __pyx_L3_error)
11821  }
11822  CYTHON_FALLTHROUGH;
11823  case 11:
11824  if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_grad_w)) != 0)) kw_args--;
11825  else {
11826  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 11); __PYX_ERR(0, 486, __pyx_L3_error)
11827  }
11828  CYTHON_FALLTHROUGH;
11829  case 12:
11830  if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_detJ)) != 0)) kw_args--;
11831  else {
11832  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 12); __PYX_ERR(0, 486, __pyx_L3_error)
11833  }
11834  CYTHON_FALLTHROUGH;
11835  case 13:
11836  if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_m)) != 0)) kw_args--;
11837  else {
11838  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 13); __PYX_ERR(0, 486, __pyx_L3_error)
11839  }
11840  CYTHON_FALLTHROUGH;
11841  case 14:
11842  if (likely((values[14] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_mt)) != 0)) kw_args--;
11843  else {
11844  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 14); __PYX_ERR(0, 486, __pyx_L3_error)
11845  }
11846  CYTHON_FALLTHROUGH;
11847  case 15:
11848  if (likely((values[15] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_r)) != 0)) kw_args--;
11849  else {
11850  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 15); __PYX_ERR(0, 486, __pyx_L3_error)
11851  }
11852  CYTHON_FALLTHROUGH;
11853  case 16:
11854  if (likely((values[16] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_kr)) != 0)) kw_args--;
11855  else {
11856  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 16); __PYX_ERR(0, 486, __pyx_L3_error)
11857  }
11858  CYTHON_FALLTHROUGH;
11859  case 17:
11860  if (likely((values[17] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_kr_up)) != 0)) kw_args--;
11861  else {
11862  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 17); __PYX_ERR(0, 486, __pyx_L3_error)
11863  }
11864  CYTHON_FALLTHROUGH;
11865  case 18:
11866  if (likely((values[18] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_flin)) != 0)) kw_args--;
11867  else {
11868  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 18); __PYX_ERR(0, 486, __pyx_L3_error)
11869  }
11870  CYTHON_FALLTHROUGH;
11871  case 19:
11872  if (likely((values[19] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_alin)) != 0)) kw_args--;
11873  else {
11874  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 19); __PYX_ERR(0, 486, __pyx_L3_error)
11875  }
11876  CYTHON_FALLTHROUGH;
11877  case 20:
11878  if (likely((values[20] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementResidual)) != 0)) kw_args--;
11879  else {
11880  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, 20); __PYX_ERR(0, 486, __pyx_L3_error)
11881  }
11882  }
11883  if (unlikely(kw_args > 0)) {
11884  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "RE_NCP1_getElementResidual") < 0)) __PYX_ERR(0, 486, __pyx_L3_error)
11885  }
11886  } else if (PyTuple_GET_SIZE(__pyx_args) != 21) {
11887  goto __pyx_L5_argtuple_error;
11888  } else {
11889  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11890  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11891  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11892  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
11893  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
11894  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
11895  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
11896  values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
11897  values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
11898  values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
11899  values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
11900  values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
11901  values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
11902  values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
11903  values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
11904  values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
11905  values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
11906  values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
11907  values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
11908  values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
11909  values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
11910  }
11911  __pyx_v_gravity = ((PyArrayObject *)values[0]);
11912  __pyx_v_rowptr = ((PyArrayObject *)values[1]);
11913  __pyx_v_colind = ((PyArrayObject *)values[2]);
11914  __pyx_v_nSpace = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_nSpace == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 490, __pyx_L3_error)
11915  __pyx_v_nElements_global = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_nElements_global == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 491, __pyx_L3_error)
11916  __pyx_v_nElementBoundaries_element = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_nElementBoundaries_element == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 492, __pyx_L3_error)
11917  __pyx_v_elementNeighborsArray = ((PyArrayObject *)values[6]);
11918  __pyx_v_elementBarycentersArray = ((PyArrayObject *)values[7]);
11919  __pyx_v_nDOF_test_element = __Pyx_PyInt_As_int(values[8]); if (unlikely((__pyx_v_nDOF_test_element == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 496, __pyx_L3_error)
11920  __pyx_v_q_u = ((PyArrayObject *)values[9]);
11921  __pyx_v_q_grad_u = ((PyArrayObject *)values[10]);
11922  __pyx_v_q_grad_w = ((PyArrayObject *)values[11]);
11923  __pyx_v_q_detJ = ((PyArrayObject *)values[12]);
11924  __pyx_v_q_m = ((PyArrayObject *)values[13]);
11925  __pyx_v_q_mt = ((PyArrayObject *)values[14]);
11926  __pyx_v_q_r = ((PyArrayObject *)values[15]);
11927  __pyx_v_q_kr = ((PyArrayObject *)values[16]);
11928  __pyx_v_q_kr_up = ((PyArrayObject *)values[17]);
11929  __pyx_v_q_flin = ((PyArrayObject *)values[18]);
11930  __pyx_v_q_alin = ((PyArrayObject *)values[19]);
11931  __pyx_v_elementResidual = ((PyArrayObject *)values[20]);
11932  }
11933  goto __pyx_L4_argument_unpacking_done;
11934  __pyx_L5_argtuple_error:;
11935  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementResidual", 1, 21, 21, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 486, __pyx_L3_error)
11936  __pyx_L3_error:;
11937  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_getElementResidual", __pyx_clineno, __pyx_lineno, __pyx_filename);
11938  __Pyx_RefNannyFinishContext();
11939  return NULL;
11940  __pyx_L4_argument_unpacking_done:;
11941  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gravity), __pyx_ptype_5numpy_ndarray, 1, "gravity", 0))) __PYX_ERR(0, 486, __pyx_L1_error)
11942  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rowptr), __pyx_ptype_5numpy_ndarray, 1, "rowptr", 0))) __PYX_ERR(0, 487, __pyx_L1_error)
11943  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_colind), __pyx_ptype_5numpy_ndarray, 1, "colind", 0))) __PYX_ERR(0, 488, __pyx_L1_error)
11944  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementNeighborsArray), __pyx_ptype_5numpy_ndarray, 1, "elementNeighborsArray", 0))) __PYX_ERR(0, 493, __pyx_L1_error)
11945  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBarycentersArray), __pyx_ptype_5numpy_ndarray, 1, "elementBarycentersArray", 0))) __PYX_ERR(0, 494, __pyx_L1_error)
11946  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_u), __pyx_ptype_5numpy_ndarray, 1, "q_u", 0))) __PYX_ERR(0, 497, __pyx_L1_error)
11947  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_grad_u), __pyx_ptype_5numpy_ndarray, 1, "q_grad_u", 0))) __PYX_ERR(0, 498, __pyx_L1_error)
11948  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_grad_w), __pyx_ptype_5numpy_ndarray, 1, "q_grad_w", 0))) __PYX_ERR(0, 499, __pyx_L1_error)
11949  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_detJ), __pyx_ptype_5numpy_ndarray, 1, "q_detJ", 0))) __PYX_ERR(0, 501, __pyx_L1_error)
11950  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_m), __pyx_ptype_5numpy_ndarray, 1, "q_m", 0))) __PYX_ERR(0, 502, __pyx_L1_error)
11951  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_mt), __pyx_ptype_5numpy_ndarray, 1, "q_mt", 0))) __PYX_ERR(0, 503, __pyx_L1_error)
11952  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_r), __pyx_ptype_5numpy_ndarray, 1, "q_r", 0))) __PYX_ERR(0, 504, __pyx_L1_error)
11953  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_kr), __pyx_ptype_5numpy_ndarray, 1, "q_kr", 0))) __PYX_ERR(0, 505, __pyx_L1_error)
11954  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_kr_up), __pyx_ptype_5numpy_ndarray, 1, "q_kr_up", 0))) __PYX_ERR(0, 506, __pyx_L1_error)
11955  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_flin), __pyx_ptype_5numpy_ndarray, 1, "q_flin", 0))) __PYX_ERR(0, 509, __pyx_L1_error)
11956  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_alin), __pyx_ptype_5numpy_ndarray, 1, "q_alin", 0))) __PYX_ERR(0, 510, __pyx_L1_error)
11957  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementResidual), __pyx_ptype_5numpy_ndarray, 1, "elementResidual", 0))) __PYX_ERR(0, 512, __pyx_L1_error)
11958  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_32RE_NCP1_getElementResidual(__pyx_self, __pyx_v_gravity, __pyx_v_rowptr, __pyx_v_colind, __pyx_v_nSpace, __pyx_v_nElements_global, __pyx_v_nElementBoundaries_element, __pyx_v_elementNeighborsArray, __pyx_v_elementBarycentersArray, __pyx_v_nDOF_test_element, __pyx_v_q_u, __pyx_v_q_grad_u, __pyx_v_q_grad_w, __pyx_v_q_detJ, __pyx_v_q_m, __pyx_v_q_mt, __pyx_v_q_r, __pyx_v_q_kr, __pyx_v_q_kr_up, __pyx_v_q_flin, __pyx_v_q_alin, __pyx_v_elementResidual);
11959 
11960  /* function exit code */
11961  goto __pyx_L0;
11962  __pyx_L1_error:;
11963  __pyx_r = NULL;
11964  __pyx_L0:;
11965  __Pyx_RefNannyFinishContext();
11966  return __pyx_r;
11967 }
11968 
11969 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_32RE_NCP1_getElementResidual(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_rowptr, PyArrayObject *__pyx_v_colind, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, CYTHON_UNUSED PyArrayObject *__pyx_v_elementNeighborsArray, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBarycentersArray, int __pyx_v_nDOF_test_element, PyArrayObject *__pyx_v_q_u, PyArrayObject *__pyx_v_q_grad_u, PyArrayObject *__pyx_v_q_grad_w, PyArrayObject *__pyx_v_q_detJ, PyArrayObject *__pyx_v_q_m, PyArrayObject *__pyx_v_q_mt, PyArrayObject *__pyx_v_q_r, PyArrayObject *__pyx_v_q_kr, PyArrayObject *__pyx_v_q_kr_up, PyArrayObject *__pyx_v_q_flin, PyArrayObject *__pyx_v_q_alin, PyArrayObject *__pyx_v_elementResidual) {
11970  CYTHON_UNUSED int __pyx_v_upwindFlag;
11971  PyObject *__pyx_v_q = NULL;
11972  int __pyx_v_nnz;
11973  int __pyx_v_eN;
11974  int __pyx_v_ii;
11975  int __pyx_v_I;
11976  int __pyx_v_i;
11977  int __pyx_v_ebN;
11978  PyArrayObject *__pyx_v_a_up = 0;
11979  PyArrayObject *__pyx_v_f_up = 0;
11980  double __pyx_v_nAvgWeight;
11981  double __pyx_v_weight;
11982  double __pyx_v_volFactor;
11983  double __pyx_v_volume;
11984  __Pyx_LocalBuf_ND __pyx_pybuffernd_a_up;
11985  __Pyx_Buffer __pyx_pybuffer_a_up;
11986  __Pyx_LocalBuf_ND __pyx_pybuffernd_colind;
11987  __Pyx_Buffer __pyx_pybuffer_colind;
11988  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBarycentersArray;
11989  __Pyx_Buffer __pyx_pybuffer_elementBarycentersArray;
11990  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementNeighborsArray;
11991  __Pyx_Buffer __pyx_pybuffer_elementNeighborsArray;
11992  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementResidual;
11993  __Pyx_Buffer __pyx_pybuffer_elementResidual;
11994  __Pyx_LocalBuf_ND __pyx_pybuffernd_f_up;
11995  __Pyx_Buffer __pyx_pybuffer_f_up;
11996  __Pyx_LocalBuf_ND __pyx_pybuffernd_gravity;
11997  __Pyx_Buffer __pyx_pybuffer_gravity;
11998  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_alin;
11999  __Pyx_Buffer __pyx_pybuffer_q_alin;
12000  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_detJ;
12001  __Pyx_Buffer __pyx_pybuffer_q_detJ;
12002  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_flin;
12003  __Pyx_Buffer __pyx_pybuffer_q_flin;
12004  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_grad_u;
12005  __Pyx_Buffer __pyx_pybuffer_q_grad_u;
12006  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_grad_w;
12007  __Pyx_Buffer __pyx_pybuffer_q_grad_w;
12008  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_kr;
12009  __Pyx_Buffer __pyx_pybuffer_q_kr;
12010  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_kr_up;
12011  __Pyx_Buffer __pyx_pybuffer_q_kr_up;
12012  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_m;
12013  __Pyx_Buffer __pyx_pybuffer_q_m;
12014  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_mt;
12015  __Pyx_Buffer __pyx_pybuffer_q_mt;
12016  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_r;
12017  __Pyx_Buffer __pyx_pybuffer_q_r;
12018  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_u;
12019  __Pyx_Buffer __pyx_pybuffer_q_u;
12020  __Pyx_LocalBuf_ND __pyx_pybuffernd_rowptr;
12021  __Pyx_Buffer __pyx_pybuffer_rowptr;
12022  PyObject *__pyx_r = NULL;
12023  __Pyx_RefNannyDeclarations
12024  PyObject *__pyx_t_1 = NULL;
12025  PyObject *__pyx_t_2 = NULL;
12026  Py_ssize_t __pyx_t_3;
12027  PyObject *__pyx_t_4 = NULL;
12028  PyObject *__pyx_t_5 = NULL;
12029  int __pyx_t_6;
12030  Py_ssize_t __pyx_t_7;
12031  int __pyx_t_8;
12032  PyObject *__pyx_t_9 = NULL;
12033  PyArrayObject *__pyx_t_10 = NULL;
12034  PyArrayObject *__pyx_t_11 = NULL;
12035  double __pyx_t_12;
12036  int __pyx_t_13;
12037  int __pyx_t_14;
12038  Py_ssize_t __pyx_t_15;
12039  int __pyx_t_16;
12040  int __pyx_t_17;
12041  int __pyx_t_18;
12042  int __pyx_t_19;
12043  Py_ssize_t __pyx_t_20;
12044  Py_ssize_t __pyx_t_21;
12045  int __pyx_t_22;
12046  int __pyx_t_23;
12047  int __pyx_t_24;
12048  int __pyx_t_25;
12049  int __pyx_t_26;
12050  int __pyx_t_27;
12051  Py_ssize_t __pyx_t_28;
12052  Py_ssize_t __pyx_t_29;
12053  Py_ssize_t __pyx_t_30;
12054  __pyx_t_28subsurfaceTransportFunctions_ITYPE_t __pyx_t_31;
12055  __pyx_t_28subsurfaceTransportFunctions_ITYPE_t __pyx_t_32;
12056  int __pyx_t_33;
12057  Py_ssize_t __pyx_t_34;
12058  Py_ssize_t __pyx_t_35;
12059  Py_ssize_t __pyx_t_36;
12060  Py_ssize_t __pyx_t_37;
12061  Py_ssize_t __pyx_t_38;
12062  int __pyx_lineno = 0;
12063  const char *__pyx_filename = NULL;
12064  int __pyx_clineno = 0;
12065  __Pyx_RefNannySetupContext("RE_NCP1_getElementResidual", 0);
12066  __pyx_pybuffer_a_up.pybuffer.buf = NULL;
12067  __pyx_pybuffer_a_up.refcount = 0;
12068  __pyx_pybuffernd_a_up.data = NULL;
12069  __pyx_pybuffernd_a_up.rcbuffer = &__pyx_pybuffer_a_up;
12070  __pyx_pybuffer_f_up.pybuffer.buf = NULL;
12071  __pyx_pybuffer_f_up.refcount = 0;
12072  __pyx_pybuffernd_f_up.data = NULL;
12073  __pyx_pybuffernd_f_up.rcbuffer = &__pyx_pybuffer_f_up;
12074  __pyx_pybuffer_gravity.pybuffer.buf = NULL;
12075  __pyx_pybuffer_gravity.refcount = 0;
12076  __pyx_pybuffernd_gravity.data = NULL;
12077  __pyx_pybuffernd_gravity.rcbuffer = &__pyx_pybuffer_gravity;
12078  __pyx_pybuffer_rowptr.pybuffer.buf = NULL;
12079  __pyx_pybuffer_rowptr.refcount = 0;
12080  __pyx_pybuffernd_rowptr.data = NULL;
12081  __pyx_pybuffernd_rowptr.rcbuffer = &__pyx_pybuffer_rowptr;
12082  __pyx_pybuffer_colind.pybuffer.buf = NULL;
12083  __pyx_pybuffer_colind.refcount = 0;
12084  __pyx_pybuffernd_colind.data = NULL;
12085  __pyx_pybuffernd_colind.rcbuffer = &__pyx_pybuffer_colind;
12086  __pyx_pybuffer_elementNeighborsArray.pybuffer.buf = NULL;
12087  __pyx_pybuffer_elementNeighborsArray.refcount = 0;
12088  __pyx_pybuffernd_elementNeighborsArray.data = NULL;
12089  __pyx_pybuffernd_elementNeighborsArray.rcbuffer = &__pyx_pybuffer_elementNeighborsArray;
12090  __pyx_pybuffer_elementBarycentersArray.pybuffer.buf = NULL;
12091  __pyx_pybuffer_elementBarycentersArray.refcount = 0;
12092  __pyx_pybuffernd_elementBarycentersArray.data = NULL;
12093  __pyx_pybuffernd_elementBarycentersArray.rcbuffer = &__pyx_pybuffer_elementBarycentersArray;
12094  __pyx_pybuffer_q_u.pybuffer.buf = NULL;
12095  __pyx_pybuffer_q_u.refcount = 0;
12096  __pyx_pybuffernd_q_u.data = NULL;
12097  __pyx_pybuffernd_q_u.rcbuffer = &__pyx_pybuffer_q_u;
12098  __pyx_pybuffer_q_grad_u.pybuffer.buf = NULL;
12099  __pyx_pybuffer_q_grad_u.refcount = 0;
12100  __pyx_pybuffernd_q_grad_u.data = NULL;
12101  __pyx_pybuffernd_q_grad_u.rcbuffer = &__pyx_pybuffer_q_grad_u;
12102  __pyx_pybuffer_q_grad_w.pybuffer.buf = NULL;
12103  __pyx_pybuffer_q_grad_w.refcount = 0;
12104  __pyx_pybuffernd_q_grad_w.data = NULL;
12105  __pyx_pybuffernd_q_grad_w.rcbuffer = &__pyx_pybuffer_q_grad_w;
12106  __pyx_pybuffer_q_detJ.pybuffer.buf = NULL;
12107  __pyx_pybuffer_q_detJ.refcount = 0;
12108  __pyx_pybuffernd_q_detJ.data = NULL;
12109  __pyx_pybuffernd_q_detJ.rcbuffer = &__pyx_pybuffer_q_detJ;
12110  __pyx_pybuffer_q_m.pybuffer.buf = NULL;
12111  __pyx_pybuffer_q_m.refcount = 0;
12112  __pyx_pybuffernd_q_m.data = NULL;
12113  __pyx_pybuffernd_q_m.rcbuffer = &__pyx_pybuffer_q_m;
12114  __pyx_pybuffer_q_mt.pybuffer.buf = NULL;
12115  __pyx_pybuffer_q_mt.refcount = 0;
12116  __pyx_pybuffernd_q_mt.data = NULL;
12117  __pyx_pybuffernd_q_mt.rcbuffer = &__pyx_pybuffer_q_mt;
12118  __pyx_pybuffer_q_r.pybuffer.buf = NULL;
12119  __pyx_pybuffer_q_r.refcount = 0;
12120  __pyx_pybuffernd_q_r.data = NULL;
12121  __pyx_pybuffernd_q_r.rcbuffer = &__pyx_pybuffer_q_r;
12122  __pyx_pybuffer_q_kr.pybuffer.buf = NULL;
12123  __pyx_pybuffer_q_kr.refcount = 0;
12124  __pyx_pybuffernd_q_kr.data = NULL;
12125  __pyx_pybuffernd_q_kr.rcbuffer = &__pyx_pybuffer_q_kr;
12126  __pyx_pybuffer_q_kr_up.pybuffer.buf = NULL;
12127  __pyx_pybuffer_q_kr_up.refcount = 0;
12128  __pyx_pybuffernd_q_kr_up.data = NULL;
12129  __pyx_pybuffernd_q_kr_up.rcbuffer = &__pyx_pybuffer_q_kr_up;
12130  __pyx_pybuffer_q_flin.pybuffer.buf = NULL;
12131  __pyx_pybuffer_q_flin.refcount = 0;
12132  __pyx_pybuffernd_q_flin.data = NULL;
12133  __pyx_pybuffernd_q_flin.rcbuffer = &__pyx_pybuffer_q_flin;
12134  __pyx_pybuffer_q_alin.pybuffer.buf = NULL;
12135  __pyx_pybuffer_q_alin.refcount = 0;
12136  __pyx_pybuffernd_q_alin.data = NULL;
12137  __pyx_pybuffernd_q_alin.rcbuffer = &__pyx_pybuffer_q_alin;
12138  __pyx_pybuffer_elementResidual.pybuffer.buf = NULL;
12139  __pyx_pybuffer_elementResidual.refcount = 0;
12140  __pyx_pybuffernd_elementResidual.data = NULL;
12141  __pyx_pybuffernd_elementResidual.rcbuffer = &__pyx_pybuffer_elementResidual;
12142  {
12143  __Pyx_BufFmt_StackElem __pyx_stack[1];
12144  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer, (PyObject*)__pyx_v_gravity, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12145  }
12146  __pyx_pybuffernd_gravity.diminfo[0].strides = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_gravity.diminfo[0].shape = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.shape[0];
12147  {
12148  __Pyx_BufFmt_StackElem __pyx_stack[1];
12149  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer, (PyObject*)__pyx_v_rowptr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12150  }
12151  __pyx_pybuffernd_rowptr.diminfo[0].strides = __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_rowptr.diminfo[0].shape = __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.shape[0];
12152  {
12153  __Pyx_BufFmt_StackElem __pyx_stack[1];
12154  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_colind.rcbuffer->pybuffer, (PyObject*)__pyx_v_colind, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12155  }
12156  __pyx_pybuffernd_colind.diminfo[0].strides = __pyx_pybuffernd_colind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_colind.diminfo[0].shape = __pyx_pybuffernd_colind.rcbuffer->pybuffer.shape[0];
12157  {
12158  __Pyx_BufFmt_StackElem __pyx_stack[1];
12159  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementNeighborsArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12160  }
12161  __pyx_pybuffernd_elementNeighborsArray.diminfo[0].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[1];
12162  {
12163  __Pyx_BufFmt_StackElem __pyx_stack[1];
12164  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBarycentersArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12165  }
12166  __pyx_pybuffernd_elementBarycentersArray.diminfo[0].strides = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBarycentersArray.diminfo[0].shape = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBarycentersArray.diminfo[1].strides = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBarycentersArray.diminfo[1].shape = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.shape[1];
12167  {
12168  __Pyx_BufFmt_StackElem __pyx_stack[1];
12169  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_u, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12170  }
12171  __pyx_pybuffernd_q_u.diminfo[0].strides = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_u.diminfo[0].shape = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_u.diminfo[1].strides = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_u.diminfo[1].shape = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.shape[1];
12172  {
12173  __Pyx_BufFmt_StackElem __pyx_stack[1];
12174  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_grad_u, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12175  }
12176  __pyx_pybuffernd_q_grad_u.diminfo[0].strides = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_grad_u.diminfo[0].shape = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_grad_u.diminfo[1].strides = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_grad_u.diminfo[1].shape = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_grad_u.diminfo[2].strides = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_grad_u.diminfo[2].shape = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.shape[2];
12177  {
12178  __Pyx_BufFmt_StackElem __pyx_stack[1];
12179  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_grad_w, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12180  }
12181  __pyx_pybuffernd_q_grad_w.diminfo[0].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_grad_w.diminfo[0].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_grad_w.diminfo[1].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_grad_w.diminfo[1].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_grad_w.diminfo[2].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_grad_w.diminfo[2].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_q_grad_w.diminfo[3].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_q_grad_w.diminfo[3].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[3];
12182  {
12183  __Pyx_BufFmt_StackElem __pyx_stack[1];
12184  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_detJ.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_detJ, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12185  }
12186  __pyx_pybuffernd_q_detJ.diminfo[0].strides = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_detJ.diminfo[0].shape = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_detJ.diminfo[1].strides = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_detJ.diminfo[1].shape = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.shape[1];
12187  {
12188  __Pyx_BufFmt_StackElem __pyx_stack[1];
12189  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_m.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_m, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12190  }
12191  __pyx_pybuffernd_q_m.diminfo[0].strides = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_m.diminfo[0].shape = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_m.diminfo[1].strides = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_m.diminfo[1].shape = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.shape[1];
12192  {
12193  __Pyx_BufFmt_StackElem __pyx_stack[1];
12194  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_mt.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_mt, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12195  }
12196  __pyx_pybuffernd_q_mt.diminfo[0].strides = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_mt.diminfo[0].shape = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_mt.diminfo[1].strides = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_mt.diminfo[1].shape = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.shape[1];
12197  {
12198  __Pyx_BufFmt_StackElem __pyx_stack[1];
12199  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_r, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12200  }
12201  __pyx_pybuffernd_q_r.diminfo[0].strides = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_r.diminfo[0].shape = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_r.diminfo[1].strides = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_r.diminfo[1].shape = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.shape[1];
12202  {
12203  __Pyx_BufFmt_StackElem __pyx_stack[1];
12204  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_kr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12205  }
12206  __pyx_pybuffernd_q_kr.diminfo[0].strides = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_kr.diminfo[0].shape = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_kr.diminfo[1].strides = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_kr.diminfo[1].shape = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.shape[1];
12207  {
12208  __Pyx_BufFmt_StackElem __pyx_stack[1];
12209  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_kr_up, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12210  }
12211  __pyx_pybuffernd_q_kr_up.diminfo[0].strides = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_kr_up.diminfo[0].shape = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_kr_up.diminfo[1].strides = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_kr_up.diminfo[1].shape = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.shape[1];
12212  {
12213  __Pyx_BufFmt_StackElem __pyx_stack[1];
12214  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_flin, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12215  }
12216  __pyx_pybuffernd_q_flin.diminfo[0].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_flin.diminfo[0].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_flin.diminfo[1].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_flin.diminfo[1].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_flin.diminfo[2].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_flin.diminfo[2].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[2];
12217  {
12218  __Pyx_BufFmt_StackElem __pyx_stack[1];
12219  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_alin, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12220  }
12221  __pyx_pybuffernd_q_alin.diminfo[0].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_alin.diminfo[0].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_alin.diminfo[1].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_alin.diminfo[1].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_alin.diminfo[2].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_alin.diminfo[2].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[2];
12222  {
12223  __Pyx_BufFmt_StackElem __pyx_stack[1];
12224  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementResidual.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementResidual, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 486, __pyx_L1_error)
12225  }
12226  __pyx_pybuffernd_elementResidual.diminfo[0].strides = __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementResidual.diminfo[0].shape = __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementResidual.diminfo[1].strides = __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementResidual.diminfo[1].shape = __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.shape[1];
12227 
12228  /* "subsurfaceTransportFunctions.pyx":527
12229  *
12230  * """
12231  * cdef int upwindFlag = 1 # <<<<<<<<<<<<<<
12232  * #check some sizes
12233  * for q in [q_u,q_m,q_mt,q_r,q_kr]:
12234  */
12235  __pyx_v_upwindFlag = 1;
12236 
12237  /* "subsurfaceTransportFunctions.pyx":529
12238  * cdef int upwindFlag = 1
12239  * #check some sizes
12240  * for q in [q_u,q_m,q_mt,q_r,q_kr]: # <<<<<<<<<<<<<<
12241  * assert q.shape[1] == nSpace+1
12242  * assert nDOF_test_element == nSpace+1
12243  */
12244  __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 529, __pyx_L1_error)
12245  __Pyx_GOTREF(__pyx_t_1);
12246  __Pyx_INCREF(((PyObject *)__pyx_v_q_u));
12247  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_u));
12248  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_q_u));
12249  __Pyx_INCREF(((PyObject *)__pyx_v_q_m));
12250  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_m));
12251  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_q_m));
12252  __Pyx_INCREF(((PyObject *)__pyx_v_q_mt));
12253  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_mt));
12254  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_q_mt));
12255  __Pyx_INCREF(((PyObject *)__pyx_v_q_r));
12256  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_r));
12257  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_v_q_r));
12258  __Pyx_INCREF(((PyObject *)__pyx_v_q_kr));
12259  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_kr));
12260  PyTuple_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_v_q_kr));
12261  __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
12262  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12263  for (;;) {
12264  if (__pyx_t_3 >= 5) break;
12265  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12266  __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 529, __pyx_L1_error)
12267  #else
12268  __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 529, __pyx_L1_error)
12269  __Pyx_GOTREF(__pyx_t_1);
12270  #endif
12271  __Pyx_XDECREF_SET(__pyx_v_q, __pyx_t_1);
12272  __pyx_t_1 = 0;
12273 
12274  /* "subsurfaceTransportFunctions.pyx":530
12275  * #check some sizes
12276  * for q in [q_u,q_m,q_mt,q_r,q_kr]:
12277  * assert q.shape[1] == nSpace+1 # <<<<<<<<<<<<<<
12278  * assert nDOF_test_element == nSpace+1
12279  * cdef int nnz = rowptr[nSpace]
12280  */
12281  #ifndef CYTHON_WITHOUT_ASSERTIONS
12282  if (unlikely(!Py_OptimizeFlag)) {
12283  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_q, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 530, __pyx_L1_error)
12284  __Pyx_GOTREF(__pyx_t_1);
12285  __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 530, __pyx_L1_error)
12286  __Pyx_GOTREF(__pyx_t_4);
12287  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12288  __pyx_t_1 = __Pyx_PyInt_From_long((__pyx_v_nSpace + 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 530, __pyx_L1_error)
12289  __Pyx_GOTREF(__pyx_t_1);
12290  __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 530, __pyx_L1_error)
12291  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12292  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12293  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 530, __pyx_L1_error)
12294  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12295  if (unlikely(!__pyx_t_6)) {
12296  PyErr_SetNone(PyExc_AssertionError);
12297  __PYX_ERR(0, 530, __pyx_L1_error)
12298  }
12299  }
12300  #endif
12301 
12302  /* "subsurfaceTransportFunctions.pyx":529
12303  * cdef int upwindFlag = 1
12304  * #check some sizes
12305  * for q in [q_u,q_m,q_mt,q_r,q_kr]: # <<<<<<<<<<<<<<
12306  * assert q.shape[1] == nSpace+1
12307  * assert nDOF_test_element == nSpace+1
12308  */
12309  }
12310  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12311 
12312  /* "subsurfaceTransportFunctions.pyx":531
12313  * for q in [q_u,q_m,q_mt,q_r,q_kr]:
12314  * assert q.shape[1] == nSpace+1
12315  * assert nDOF_test_element == nSpace+1 # <<<<<<<<<<<<<<
12316  * cdef int nnz = rowptr[nSpace]
12317  * #temporaries
12318  */
12319  #ifndef CYTHON_WITHOUT_ASSERTIONS
12320  if (unlikely(!Py_OptimizeFlag)) {
12321  if (unlikely(!((__pyx_v_nDOF_test_element == (__pyx_v_nSpace + 1)) != 0))) {
12322  PyErr_SetNone(PyExc_AssertionError);
12323  __PYX_ERR(0, 531, __pyx_L1_error)
12324  }
12325  }
12326  #endif
12327 
12328  /* "subsurfaceTransportFunctions.pyx":532
12329  * assert q.shape[1] == nSpace+1
12330  * assert nDOF_test_element == nSpace+1
12331  * cdef int nnz = rowptr[nSpace] # <<<<<<<<<<<<<<
12332  * #temporaries
12333  * cdef double u_eN,kr_eN,phi_eN,u_neig,kr_neig,phi_neig
12334  */
12335  __pyx_t_7 = __pyx_v_nSpace;
12336  __pyx_t_8 = -1;
12337  if (__pyx_t_7 < 0) {
12338  __pyx_t_7 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
12339  if (unlikely(__pyx_t_7 < 0)) __pyx_t_8 = 0;
12340  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_8 = 0;
12341  if (unlikely(__pyx_t_8 != -1)) {
12342  __Pyx_RaiseBufferIndexError(__pyx_t_8);
12343  __PYX_ERR(0, 532, __pyx_L1_error)
12344  }
12345  __pyx_v_nnz = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_rowptr.diminfo[0].strides));
12346 
12347  /* "subsurfaceTransportFunctions.pyx":536
12348  * cdef double u_eN,kr_eN,phi_eN,u_neig,kr_neig,phi_neig
12349  * cdef int eN,eN_neighbor,ii,I,i,ebN
12350  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_up= numpy.zeros(nnz,'d') # <<<<<<<<<<<<<<
12351  * cdef numpy.ndarray[DTYPE_t,ndim=1] f_up= numpy.zeros(nSpace,'d')
12352  * #for averaging/integration weights
12353  */
12354  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_numpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 536, __pyx_L1_error)
12355  __Pyx_GOTREF(__pyx_t_5);
12356  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 536, __pyx_L1_error)
12357  __Pyx_GOTREF(__pyx_t_1);
12358  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12359  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_nnz); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 536, __pyx_L1_error)
12360  __Pyx_GOTREF(__pyx_t_5);
12361  __pyx_t_4 = NULL;
12362  __pyx_t_8 = 0;
12363  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
12364  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
12365  if (likely(__pyx_t_4)) {
12366  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
12367  __Pyx_INCREF(__pyx_t_4);
12368  __Pyx_INCREF(function);
12369  __Pyx_DECREF_SET(__pyx_t_1, function);
12370  __pyx_t_8 = 1;
12371  }
12372  }
12373  #if CYTHON_FAST_PYCALL
12374  if (PyFunction_Check(__pyx_t_1)) {
12375  PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_n_s_d};
12376  __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 536, __pyx_L1_error)
12377  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
12378  __Pyx_GOTREF(__pyx_t_2);
12379  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12380  } else
12381  #endif
12382  #if CYTHON_FAST_PYCCALL
12383  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
12384  PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_n_s_d};
12385  __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 536, __pyx_L1_error)
12386  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
12387  __Pyx_GOTREF(__pyx_t_2);
12388  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12389  } else
12390  #endif
12391  {
12392  __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 536, __pyx_L1_error)
12393  __Pyx_GOTREF(__pyx_t_9);
12394  if (__pyx_t_4) {
12395  __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4); __pyx_t_4 = NULL;
12396  }
12397  __Pyx_GIVEREF(__pyx_t_5);
12398  PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_5);
12399  __Pyx_INCREF(__pyx_n_s_d);
12400  __Pyx_GIVEREF(__pyx_n_s_d);
12401  PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_n_s_d);
12402  __pyx_t_5 = 0;
12403  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 536, __pyx_L1_error)
12404  __Pyx_GOTREF(__pyx_t_2);
12405  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12406  }
12407  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12408  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 536, __pyx_L1_error)
12409  __pyx_t_10 = ((PyArrayObject *)__pyx_t_2);
12410  {
12411  __Pyx_BufFmt_StackElem __pyx_stack[1];
12412  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_a_up.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
12413  __pyx_v_a_up = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_a_up.rcbuffer->pybuffer.buf = NULL;
12414  __PYX_ERR(0, 536, __pyx_L1_error)
12415  } else {__pyx_pybuffernd_a_up.diminfo[0].strides = __pyx_pybuffernd_a_up.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_a_up.diminfo[0].shape = __pyx_pybuffernd_a_up.rcbuffer->pybuffer.shape[0];
12416  }
12417  }
12418  __pyx_t_10 = 0;
12419  __pyx_v_a_up = ((PyArrayObject *)__pyx_t_2);
12420  __pyx_t_2 = 0;
12421 
12422  /* "subsurfaceTransportFunctions.pyx":537
12423  * cdef int eN,eN_neighbor,ii,I,i,ebN
12424  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_up= numpy.zeros(nnz,'d')
12425  * cdef numpy.ndarray[DTYPE_t,ndim=1] f_up= numpy.zeros(nSpace,'d') # <<<<<<<<<<<<<<
12426  * #for averaging/integration weights
12427  * cdef double nAvgWeight = 1.0/(nSpace+1.)
12428  */
12429  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 537, __pyx_L1_error)
12430  __Pyx_GOTREF(__pyx_t_1);
12431  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 537, __pyx_L1_error)
12432  __Pyx_GOTREF(__pyx_t_9);
12433  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12434  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_nSpace); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 537, __pyx_L1_error)
12435  __Pyx_GOTREF(__pyx_t_1);
12436  __pyx_t_5 = NULL;
12437  __pyx_t_8 = 0;
12438  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
12439  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_9);
12440  if (likely(__pyx_t_5)) {
12441  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
12442  __Pyx_INCREF(__pyx_t_5);
12443  __Pyx_INCREF(function);
12444  __Pyx_DECREF_SET(__pyx_t_9, function);
12445  __pyx_t_8 = 1;
12446  }
12447  }
12448  #if CYTHON_FAST_PYCALL
12449  if (PyFunction_Check(__pyx_t_9)) {
12450  PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_n_s_d};
12451  __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 537, __pyx_L1_error)
12452  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
12453  __Pyx_GOTREF(__pyx_t_2);
12454  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12455  } else
12456  #endif
12457  #if CYTHON_FAST_PYCCALL
12458  if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
12459  PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_n_s_d};
12460  __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 537, __pyx_L1_error)
12461  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
12462  __Pyx_GOTREF(__pyx_t_2);
12463  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12464  } else
12465  #endif
12466  {
12467  __pyx_t_4 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 537, __pyx_L1_error)
12468  __Pyx_GOTREF(__pyx_t_4);
12469  if (__pyx_t_5) {
12470  __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL;
12471  }
12472  __Pyx_GIVEREF(__pyx_t_1);
12473  PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_8, __pyx_t_1);
12474  __Pyx_INCREF(__pyx_n_s_d);
12475  __Pyx_GIVEREF(__pyx_n_s_d);
12476  PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_8, __pyx_n_s_d);
12477  __pyx_t_1 = 0;
12478  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 537, __pyx_L1_error)
12479  __Pyx_GOTREF(__pyx_t_2);
12480  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12481  }
12482  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12483  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 537, __pyx_L1_error)
12484  __pyx_t_11 = ((PyArrayObject *)__pyx_t_2);
12485  {
12486  __Pyx_BufFmt_StackElem __pyx_stack[1];
12487  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_f_up.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
12488  __pyx_v_f_up = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_f_up.rcbuffer->pybuffer.buf = NULL;
12489  __PYX_ERR(0, 537, __pyx_L1_error)
12490  } else {__pyx_pybuffernd_f_up.diminfo[0].strides = __pyx_pybuffernd_f_up.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_f_up.diminfo[0].shape = __pyx_pybuffernd_f_up.rcbuffer->pybuffer.shape[0];
12491  }
12492  }
12493  __pyx_t_11 = 0;
12494  __pyx_v_f_up = ((PyArrayObject *)__pyx_t_2);
12495  __pyx_t_2 = 0;
12496 
12497  /* "subsurfaceTransportFunctions.pyx":539
12498  * cdef numpy.ndarray[DTYPE_t,ndim=1] f_up= numpy.zeros(nSpace,'d')
12499  * #for averaging/integration weights
12500  * cdef double nAvgWeight = 1.0/(nSpace+1.) # <<<<<<<<<<<<<<
12501  * cdef double weight=1.0,volFactor = 1.0
12502  * if nSpace == 2:
12503  */
12504  __pyx_t_12 = (__pyx_v_nSpace + 1.);
12505  if (unlikely(__pyx_t_12 == 0)) {
12506  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
12507  __PYX_ERR(0, 539, __pyx_L1_error)
12508  }
12509  __pyx_v_nAvgWeight = (1.0 / __pyx_t_12);
12510 
12511  /* "subsurfaceTransportFunctions.pyx":540
12512  * #for averaging/integration weights
12513  * cdef double nAvgWeight = 1.0/(nSpace+1.)
12514  * cdef double weight=1.0,volFactor = 1.0 # <<<<<<<<<<<<<<
12515  * if nSpace == 2:
12516  * volFactor = 0.5
12517  */
12518  __pyx_v_weight = 1.0;
12519  __pyx_v_volFactor = 1.0;
12520 
12521  /* "subsurfaceTransportFunctions.pyx":541
12522  * cdef double nAvgWeight = 1.0/(nSpace+1.)
12523  * cdef double weight=1.0,volFactor = 1.0
12524  * if nSpace == 2: # <<<<<<<<<<<<<<
12525  * volFactor = 0.5
12526  * if nSpace == 3:
12527  */
12528  __pyx_t_6 = ((__pyx_v_nSpace == 2) != 0);
12529  if (__pyx_t_6) {
12530 
12531  /* "subsurfaceTransportFunctions.pyx":542
12532  * cdef double weight=1.0,volFactor = 1.0
12533  * if nSpace == 2:
12534  * volFactor = 0.5 # <<<<<<<<<<<<<<
12535  * if nSpace == 3:
12536  * volFactor = 1.0/6.0
12537  */
12538  __pyx_v_volFactor = 0.5;
12539 
12540  /* "subsurfaceTransportFunctions.pyx":541
12541  * cdef double nAvgWeight = 1.0/(nSpace+1.)
12542  * cdef double weight=1.0,volFactor = 1.0
12543  * if nSpace == 2: # <<<<<<<<<<<<<<
12544  * volFactor = 0.5
12545  * if nSpace == 3:
12546  */
12547  }
12548 
12549  /* "subsurfaceTransportFunctions.pyx":543
12550  * if nSpace == 2:
12551  * volFactor = 0.5
12552  * if nSpace == 3: # <<<<<<<<<<<<<<
12553  * volFactor = 1.0/6.0
12554  * #
12555  */
12556  __pyx_t_6 = ((__pyx_v_nSpace == 3) != 0);
12557  if (__pyx_t_6) {
12558 
12559  /* "subsurfaceTransportFunctions.pyx":544
12560  * volFactor = 0.5
12561  * if nSpace == 3:
12562  * volFactor = 1.0/6.0 # <<<<<<<<<<<<<<
12563  * #
12564  * for eN in range(nElements_global):
12565  */
12566  __pyx_v_volFactor = (1.0 / 6.0);
12567 
12568  /* "subsurfaceTransportFunctions.pyx":543
12569  * if nSpace == 2:
12570  * volFactor = 0.5
12571  * if nSpace == 3: # <<<<<<<<<<<<<<
12572  * volFactor = 1.0/6.0
12573  * #
12574  */
12575  }
12576 
12577  /* "subsurfaceTransportFunctions.pyx":546
12578  * volFactor = 1.0/6.0
12579  * #
12580  * for eN in range(nElements_global): # <<<<<<<<<<<<<<
12581  * volume = volFactor*fabs(q_detJ[eN,0]) #affine transformation
12582  * weight = nAvgWeight*volume
12583  */
12584  __pyx_t_8 = __pyx_v_nElements_global;
12585  __pyx_t_13 = __pyx_t_8;
12586  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
12587  __pyx_v_eN = __pyx_t_14;
12588 
12589  /* "subsurfaceTransportFunctions.pyx":547
12590  * #
12591  * for eN in range(nElements_global):
12592  * volume = volFactor*fabs(q_detJ[eN,0]) #affine transformation # <<<<<<<<<<<<<<
12593  * weight = nAvgWeight*volume
12594  *
12595  */
12596  __pyx_t_7 = __pyx_v_eN;
12597  __pyx_t_15 = 0;
12598  __pyx_t_16 = -1;
12599  if (__pyx_t_7 < 0) {
12600  __pyx_t_7 += __pyx_pybuffernd_q_detJ.diminfo[0].shape;
12601  if (unlikely(__pyx_t_7 < 0)) __pyx_t_16 = 0;
12602  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_q_detJ.diminfo[0].shape)) __pyx_t_16 = 0;
12603  if (__pyx_t_15 < 0) {
12604  __pyx_t_15 += __pyx_pybuffernd_q_detJ.diminfo[1].shape;
12605  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 1;
12606  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_detJ.diminfo[1].shape)) __pyx_t_16 = 1;
12607  if (unlikely(__pyx_t_16 != -1)) {
12608  __Pyx_RaiseBufferIndexError(__pyx_t_16);
12609  __PYX_ERR(0, 547, __pyx_L1_error)
12610  }
12611  __pyx_v_volume = (__pyx_v_volFactor * fabs((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_q_detJ.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_q_detJ.diminfo[1].strides))));
12612 
12613  /* "subsurfaceTransportFunctions.pyx":548
12614  * for eN in range(nElements_global):
12615  * volume = volFactor*fabs(q_detJ[eN,0]) #affine transformation
12616  * weight = nAvgWeight*volume # <<<<<<<<<<<<<<
12617  *
12618  * for i in range(nDOF_test_element):
12619  */
12620  __pyx_v_weight = (__pyx_v_nAvgWeight * __pyx_v_volume);
12621 
12622  /* "subsurfaceTransportFunctions.pyx":550
12623  * weight = nAvgWeight*volume
12624  *
12625  * for i in range(nDOF_test_element): # <<<<<<<<<<<<<<
12626  * #nodal quadrature so diagonal
12627  * ##mass
12628  */
12629  __pyx_t_16 = __pyx_v_nDOF_test_element;
12630  __pyx_t_17 = __pyx_t_16;
12631  for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
12632  __pyx_v_i = __pyx_t_18;
12633 
12634  /* "subsurfaceTransportFunctions.pyx":553
12635  * #nodal quadrature so diagonal
12636  * ##mass
12637  * elementResidual[eN,i] += weight*q_mt[eN,i] # <<<<<<<<<<<<<<
12638  * ##sources
12639  * elementResidual[eN,i] += weight*q_r[eN,i]
12640  */
12641  __pyx_t_15 = __pyx_v_eN;
12642  __pyx_t_7 = __pyx_v_i;
12643  __pyx_t_19 = -1;
12644  if (__pyx_t_15 < 0) {
12645  __pyx_t_15 += __pyx_pybuffernd_q_mt.diminfo[0].shape;
12646  if (unlikely(__pyx_t_15 < 0)) __pyx_t_19 = 0;
12647  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_mt.diminfo[0].shape)) __pyx_t_19 = 0;
12648  if (__pyx_t_7 < 0) {
12649  __pyx_t_7 += __pyx_pybuffernd_q_mt.diminfo[1].shape;
12650  if (unlikely(__pyx_t_7 < 0)) __pyx_t_19 = 1;
12651  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_q_mt.diminfo[1].shape)) __pyx_t_19 = 1;
12652  if (unlikely(__pyx_t_19 != -1)) {
12653  __Pyx_RaiseBufferIndexError(__pyx_t_19);
12654  __PYX_ERR(0, 553, __pyx_L1_error)
12655  }
12656  __pyx_t_20 = __pyx_v_eN;
12657  __pyx_t_21 = __pyx_v_i;
12658  __pyx_t_19 = -1;
12659  if (__pyx_t_20 < 0) {
12660  __pyx_t_20 += __pyx_pybuffernd_elementResidual.diminfo[0].shape;
12661  if (unlikely(__pyx_t_20 < 0)) __pyx_t_19 = 0;
12662  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_elementResidual.diminfo[0].shape)) __pyx_t_19 = 0;
12663  if (__pyx_t_21 < 0) {
12664  __pyx_t_21 += __pyx_pybuffernd_elementResidual.diminfo[1].shape;
12665  if (unlikely(__pyx_t_21 < 0)) __pyx_t_19 = 1;
12666  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_elementResidual.diminfo[1].shape)) __pyx_t_19 = 1;
12667  if (unlikely(__pyx_t_19 != -1)) {
12668  __Pyx_RaiseBufferIndexError(__pyx_t_19);
12669  __PYX_ERR(0, 553, __pyx_L1_error)
12670  }
12671  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_elementResidual.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_elementResidual.diminfo[1].strides) += (__pyx_v_weight * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_q_mt.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_q_mt.diminfo[1].strides)));
12672 
12673  /* "subsurfaceTransportFunctions.pyx":555
12674  * elementResidual[eN,i] += weight*q_mt[eN,i]
12675  * ##sources
12676  * elementResidual[eN,i] += weight*q_r[eN,i] # <<<<<<<<<<<<<<
12677  *
12678  * #have to actually compute loop over other nodes for stiffness terms
12679  */
12680  __pyx_t_7 = __pyx_v_eN;
12681  __pyx_t_15 = __pyx_v_i;
12682  __pyx_t_19 = -1;
12683  if (__pyx_t_7 < 0) {
12684  __pyx_t_7 += __pyx_pybuffernd_q_r.diminfo[0].shape;
12685  if (unlikely(__pyx_t_7 < 0)) __pyx_t_19 = 0;
12686  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_q_r.diminfo[0].shape)) __pyx_t_19 = 0;
12687  if (__pyx_t_15 < 0) {
12688  __pyx_t_15 += __pyx_pybuffernd_q_r.diminfo[1].shape;
12689  if (unlikely(__pyx_t_15 < 0)) __pyx_t_19 = 1;
12690  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_r.diminfo[1].shape)) __pyx_t_19 = 1;
12691  if (unlikely(__pyx_t_19 != -1)) {
12692  __Pyx_RaiseBufferIndexError(__pyx_t_19);
12693  __PYX_ERR(0, 555, __pyx_L1_error)
12694  }
12695  __pyx_t_21 = __pyx_v_eN;
12696  __pyx_t_20 = __pyx_v_i;
12697  __pyx_t_19 = -1;
12698  if (__pyx_t_21 < 0) {
12699  __pyx_t_21 += __pyx_pybuffernd_elementResidual.diminfo[0].shape;
12700  if (unlikely(__pyx_t_21 < 0)) __pyx_t_19 = 0;
12701  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_elementResidual.diminfo[0].shape)) __pyx_t_19 = 0;
12702  if (__pyx_t_20 < 0) {
12703  __pyx_t_20 += __pyx_pybuffernd_elementResidual.diminfo[1].shape;
12704  if (unlikely(__pyx_t_20 < 0)) __pyx_t_19 = 1;
12705  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_elementResidual.diminfo[1].shape)) __pyx_t_19 = 1;
12706  if (unlikely(__pyx_t_19 != -1)) {
12707  __Pyx_RaiseBufferIndexError(__pyx_t_19);
12708  __PYX_ERR(0, 555, __pyx_L1_error)
12709  }
12710  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_elementResidual.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_elementResidual.diminfo[1].strides) += (__pyx_v_weight * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_r.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_q_r.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_q_r.diminfo[1].strides)));
12711 
12712  /* "subsurfaceTransportFunctions.pyx":558
12713  *
12714  * #have to actually compute loop over other nodes for stiffness terms
12715  * for ebN in range(nElementBoundaries_element): #same as nDOF_trial , nElementBoundaries_ # <<<<<<<<<<<<<<
12716  * #assumes linear parts of f and a and upwind k_r have already been evaluated correctly for interface
12717  * for ii in range(nnz):
12718  */
12719  __pyx_t_19 = __pyx_v_nElementBoundaries_element;
12720  __pyx_t_22 = __pyx_t_19;
12721  for (__pyx_t_23 = 0; __pyx_t_23 < __pyx_t_22; __pyx_t_23+=1) {
12722  __pyx_v_ebN = __pyx_t_23;
12723 
12724  /* "subsurfaceTransportFunctions.pyx":560
12725  * for ebN in range(nElementBoundaries_element): #same as nDOF_trial , nElementBoundaries_
12726  * #assumes linear parts of f and a and upwind k_r have already been evaluated correctly for interface
12727  * for ii in range(nnz): # <<<<<<<<<<<<<<
12728  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN]
12729  * for I in range(nSpace):
12730  */
12731  __pyx_t_24 = __pyx_v_nnz;
12732  __pyx_t_25 = __pyx_t_24;
12733  for (__pyx_t_26 = 0; __pyx_t_26 < __pyx_t_25; __pyx_t_26+=1) {
12734  __pyx_v_ii = __pyx_t_26;
12735 
12736  /* "subsurfaceTransportFunctions.pyx":561
12737  * #assumes linear parts of f and a and upwind k_r have already been evaluated correctly for interface
12738  * for ii in range(nnz):
12739  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN] # <<<<<<<<<<<<<<
12740  * for I in range(nSpace):
12741  * f_up[I] = q_flin[eN,ebN,I]*q_kr_up[eN,ebN]
12742  */
12743  __pyx_t_15 = __pyx_v_eN;
12744  __pyx_t_7 = __pyx_v_ebN;
12745  __pyx_t_20 = __pyx_v_ii;
12746  __pyx_t_27 = -1;
12747  if (__pyx_t_15 < 0) {
12748  __pyx_t_15 += __pyx_pybuffernd_q_alin.diminfo[0].shape;
12749  if (unlikely(__pyx_t_15 < 0)) __pyx_t_27 = 0;
12750  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_alin.diminfo[0].shape)) __pyx_t_27 = 0;
12751  if (__pyx_t_7 < 0) {
12752  __pyx_t_7 += __pyx_pybuffernd_q_alin.diminfo[1].shape;
12753  if (unlikely(__pyx_t_7 < 0)) __pyx_t_27 = 1;
12754  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_q_alin.diminfo[1].shape)) __pyx_t_27 = 1;
12755  if (__pyx_t_20 < 0) {
12756  __pyx_t_20 += __pyx_pybuffernd_q_alin.diminfo[2].shape;
12757  if (unlikely(__pyx_t_20 < 0)) __pyx_t_27 = 2;
12758  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_q_alin.diminfo[2].shape)) __pyx_t_27 = 2;
12759  if (unlikely(__pyx_t_27 != -1)) {
12760  __Pyx_RaiseBufferIndexError(__pyx_t_27);
12761  __PYX_ERR(0, 561, __pyx_L1_error)
12762  }
12763  __pyx_t_21 = __pyx_v_eN;
12764  __pyx_t_28 = __pyx_v_ebN;
12765  __pyx_t_27 = -1;
12766  if (__pyx_t_21 < 0) {
12767  __pyx_t_21 += __pyx_pybuffernd_q_kr_up.diminfo[0].shape;
12768  if (unlikely(__pyx_t_21 < 0)) __pyx_t_27 = 0;
12769  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_q_kr_up.diminfo[0].shape)) __pyx_t_27 = 0;
12770  if (__pyx_t_28 < 0) {
12771  __pyx_t_28 += __pyx_pybuffernd_q_kr_up.diminfo[1].shape;
12772  if (unlikely(__pyx_t_28 < 0)) __pyx_t_27 = 1;
12773  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_q_kr_up.diminfo[1].shape)) __pyx_t_27 = 1;
12774  if (unlikely(__pyx_t_27 != -1)) {
12775  __Pyx_RaiseBufferIndexError(__pyx_t_27);
12776  __PYX_ERR(0, 561, __pyx_L1_error)
12777  }
12778  __pyx_t_29 = __pyx_v_ii;
12779  __pyx_t_27 = -1;
12780  if (__pyx_t_29 < 0) {
12781  __pyx_t_29 += __pyx_pybuffernd_a_up.diminfo[0].shape;
12782  if (unlikely(__pyx_t_29 < 0)) __pyx_t_27 = 0;
12783  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_a_up.diminfo[0].shape)) __pyx_t_27 = 0;
12784  if (unlikely(__pyx_t_27 != -1)) {
12785  __Pyx_RaiseBufferIndexError(__pyx_t_27);
12786  __PYX_ERR(0, 561, __pyx_L1_error)
12787  }
12788  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_up.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_a_up.diminfo[0].strides) = ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_q_alin.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_q_alin.diminfo[1].strides, __pyx_t_20, __pyx_pybuffernd_q_alin.diminfo[2].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_q_kr_up.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_q_kr_up.diminfo[1].strides)));
12789  }
12790 
12791  /* "subsurfaceTransportFunctions.pyx":562
12792  * for ii in range(nnz):
12793  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN]
12794  * for I in range(nSpace): # <<<<<<<<<<<<<<
12795  * f_up[I] = q_flin[eN,ebN,I]*q_kr_up[eN,ebN]
12796  * #
12797  */
12798  __pyx_t_24 = __pyx_v_nSpace;
12799  __pyx_t_25 = __pyx_t_24;
12800  for (__pyx_t_26 = 0; __pyx_t_26 < __pyx_t_25; __pyx_t_26+=1) {
12801  __pyx_v_I = __pyx_t_26;
12802 
12803  /* "subsurfaceTransportFunctions.pyx":563
12804  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN]
12805  * for I in range(nSpace):
12806  * f_up[I] = q_flin[eN,ebN,I]*q_kr_up[eN,ebN] # <<<<<<<<<<<<<<
12807  * #
12808  * #accumulate advection and stiffness contributions
12809  */
12810  __pyx_t_28 = __pyx_v_eN;
12811  __pyx_t_21 = __pyx_v_ebN;
12812  __pyx_t_20 = __pyx_v_I;
12813  __pyx_t_27 = -1;
12814  if (__pyx_t_28 < 0) {
12815  __pyx_t_28 += __pyx_pybuffernd_q_flin.diminfo[0].shape;
12816  if (unlikely(__pyx_t_28 < 0)) __pyx_t_27 = 0;
12817  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_q_flin.diminfo[0].shape)) __pyx_t_27 = 0;
12818  if (__pyx_t_21 < 0) {
12819  __pyx_t_21 += __pyx_pybuffernd_q_flin.diminfo[1].shape;
12820  if (unlikely(__pyx_t_21 < 0)) __pyx_t_27 = 1;
12821  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_q_flin.diminfo[1].shape)) __pyx_t_27 = 1;
12822  if (__pyx_t_20 < 0) {
12823  __pyx_t_20 += __pyx_pybuffernd_q_flin.diminfo[2].shape;
12824  if (unlikely(__pyx_t_20 < 0)) __pyx_t_27 = 2;
12825  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_q_flin.diminfo[2].shape)) __pyx_t_27 = 2;
12826  if (unlikely(__pyx_t_27 != -1)) {
12827  __Pyx_RaiseBufferIndexError(__pyx_t_27);
12828  __PYX_ERR(0, 563, __pyx_L1_error)
12829  }
12830  __pyx_t_7 = __pyx_v_eN;
12831  __pyx_t_15 = __pyx_v_ebN;
12832  __pyx_t_27 = -1;
12833  if (__pyx_t_7 < 0) {
12834  __pyx_t_7 += __pyx_pybuffernd_q_kr_up.diminfo[0].shape;
12835  if (unlikely(__pyx_t_7 < 0)) __pyx_t_27 = 0;
12836  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_q_kr_up.diminfo[0].shape)) __pyx_t_27 = 0;
12837  if (__pyx_t_15 < 0) {
12838  __pyx_t_15 += __pyx_pybuffernd_q_kr_up.diminfo[1].shape;
12839  if (unlikely(__pyx_t_15 < 0)) __pyx_t_27 = 1;
12840  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_kr_up.diminfo[1].shape)) __pyx_t_27 = 1;
12841  if (unlikely(__pyx_t_27 != -1)) {
12842  __Pyx_RaiseBufferIndexError(__pyx_t_27);
12843  __PYX_ERR(0, 563, __pyx_L1_error)
12844  }
12845  __pyx_t_29 = __pyx_v_I;
12846  __pyx_t_27 = -1;
12847  if (__pyx_t_29 < 0) {
12848  __pyx_t_29 += __pyx_pybuffernd_f_up.diminfo[0].shape;
12849  if (unlikely(__pyx_t_29 < 0)) __pyx_t_27 = 0;
12850  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_f_up.diminfo[0].shape)) __pyx_t_27 = 0;
12851  if (unlikely(__pyx_t_27 != -1)) {
12852  __Pyx_RaiseBufferIndexError(__pyx_t_27);
12853  __PYX_ERR(0, 563, __pyx_L1_error)
12854  }
12855  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_f_up.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_f_up.diminfo[0].strides) = ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_q_flin.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_q_flin.diminfo[1].strides, __pyx_t_20, __pyx_pybuffernd_q_flin.diminfo[2].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_q_kr_up.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_q_kr_up.diminfo[1].strides)));
12856  }
12857 
12858  /* "subsurfaceTransportFunctions.pyx":566
12859  * #
12860  * #accumulate advection and stiffness contributions
12861  * for I in range(nSpace): # <<<<<<<<<<<<<<
12862  * elementResidual[eN,i] -= weight*f_up[I]*q_grad_w[eN,ebN,i,I]
12863  * for ii in range(rowptr[I],rowptr[I+1]):
12864  */
12865  __pyx_t_24 = __pyx_v_nSpace;
12866  __pyx_t_25 = __pyx_t_24;
12867  for (__pyx_t_26 = 0; __pyx_t_26 < __pyx_t_25; __pyx_t_26+=1) {
12868  __pyx_v_I = __pyx_t_26;
12869 
12870  /* "subsurfaceTransportFunctions.pyx":567
12871  * #accumulate advection and stiffness contributions
12872  * for I in range(nSpace):
12873  * elementResidual[eN,i] -= weight*f_up[I]*q_grad_w[eN,ebN,i,I] # <<<<<<<<<<<<<<
12874  * for ii in range(rowptr[I],rowptr[I+1]):
12875  * elementResidual[eN,i] += weight*a_up[ii]*q_grad_u[eN,ebN,colind[ii]]*q_grad_w[eN,ebN,i,I]
12876  */
12877  __pyx_t_15 = __pyx_v_I;
12878  __pyx_t_27 = -1;
12879  if (__pyx_t_15 < 0) {
12880  __pyx_t_15 += __pyx_pybuffernd_f_up.diminfo[0].shape;
12881  if (unlikely(__pyx_t_15 < 0)) __pyx_t_27 = 0;
12882  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_f_up.diminfo[0].shape)) __pyx_t_27 = 0;
12883  if (unlikely(__pyx_t_27 != -1)) {
12884  __Pyx_RaiseBufferIndexError(__pyx_t_27);
12885  __PYX_ERR(0, 567, __pyx_L1_error)
12886  }
12887  __pyx_t_7 = __pyx_v_eN;
12888  __pyx_t_20 = __pyx_v_ebN;
12889  __pyx_t_21 = __pyx_v_i;
12890  __pyx_t_28 = __pyx_v_I;
12891  __pyx_t_27 = -1;
12892  if (__pyx_t_7 < 0) {
12893  __pyx_t_7 += __pyx_pybuffernd_q_grad_w.diminfo[0].shape;
12894  if (unlikely(__pyx_t_7 < 0)) __pyx_t_27 = 0;
12895  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_q_grad_w.diminfo[0].shape)) __pyx_t_27 = 0;
12896  if (__pyx_t_20 < 0) {
12897  __pyx_t_20 += __pyx_pybuffernd_q_grad_w.diminfo[1].shape;
12898  if (unlikely(__pyx_t_20 < 0)) __pyx_t_27 = 1;
12899  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_q_grad_w.diminfo[1].shape)) __pyx_t_27 = 1;
12900  if (__pyx_t_21 < 0) {
12901  __pyx_t_21 += __pyx_pybuffernd_q_grad_w.diminfo[2].shape;
12902  if (unlikely(__pyx_t_21 < 0)) __pyx_t_27 = 2;
12903  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_q_grad_w.diminfo[2].shape)) __pyx_t_27 = 2;
12904  if (__pyx_t_28 < 0) {
12905  __pyx_t_28 += __pyx_pybuffernd_q_grad_w.diminfo[3].shape;
12906  if (unlikely(__pyx_t_28 < 0)) __pyx_t_27 = 3;
12907  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_q_grad_w.diminfo[3].shape)) __pyx_t_27 = 3;
12908  if (unlikely(__pyx_t_27 != -1)) {
12909  __Pyx_RaiseBufferIndexError(__pyx_t_27);
12910  __PYX_ERR(0, 567, __pyx_L1_error)
12911  }
12912  __pyx_t_29 = __pyx_v_eN;
12913  __pyx_t_30 = __pyx_v_i;
12914  __pyx_t_27 = -1;
12915  if (__pyx_t_29 < 0) {
12916  __pyx_t_29 += __pyx_pybuffernd_elementResidual.diminfo[0].shape;
12917  if (unlikely(__pyx_t_29 < 0)) __pyx_t_27 = 0;
12918  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_elementResidual.diminfo[0].shape)) __pyx_t_27 = 0;
12919  if (__pyx_t_30 < 0) {
12920  __pyx_t_30 += __pyx_pybuffernd_elementResidual.diminfo[1].shape;
12921  if (unlikely(__pyx_t_30 < 0)) __pyx_t_27 = 1;
12922  } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_elementResidual.diminfo[1].shape)) __pyx_t_27 = 1;
12923  if (unlikely(__pyx_t_27 != -1)) {
12924  __Pyx_RaiseBufferIndexError(__pyx_t_27);
12925  __PYX_ERR(0, 567, __pyx_L1_error)
12926  }
12927  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_elementResidual.diminfo[0].strides, __pyx_t_30, __pyx_pybuffernd_elementResidual.diminfo[1].strides) -= ((__pyx_v_weight * (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_f_up.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_f_up.diminfo[0].strides))) * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_q_grad_w.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_q_grad_w.diminfo[1].strides, __pyx_t_21, __pyx_pybuffernd_q_grad_w.diminfo[2].strides, __pyx_t_28, __pyx_pybuffernd_q_grad_w.diminfo[3].strides)));
12928 
12929  /* "subsurfaceTransportFunctions.pyx":568
12930  * for I in range(nSpace):
12931  * elementResidual[eN,i] -= weight*f_up[I]*q_grad_w[eN,ebN,i,I]
12932  * for ii in range(rowptr[I],rowptr[I+1]): # <<<<<<<<<<<<<<
12933  * elementResidual[eN,i] += weight*a_up[ii]*q_grad_u[eN,ebN,colind[ii]]*q_grad_w[eN,ebN,i,I]
12934  * #I
12935  */
12936  __pyx_t_28 = (__pyx_v_I + 1);
12937  __pyx_t_27 = -1;
12938  if (__pyx_t_28 < 0) {
12939  __pyx_t_28 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
12940  if (unlikely(__pyx_t_28 < 0)) __pyx_t_27 = 0;
12941  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_27 = 0;
12942  if (unlikely(__pyx_t_27 != -1)) {
12943  __Pyx_RaiseBufferIndexError(__pyx_t_27);
12944  __PYX_ERR(0, 568, __pyx_L1_error)
12945  }
12946  __pyx_t_31 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_rowptr.diminfo[0].strides));
12947  __pyx_t_28 = __pyx_v_I;
12948  __pyx_t_27 = -1;
12949  if (__pyx_t_28 < 0) {
12950  __pyx_t_28 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
12951  if (unlikely(__pyx_t_28 < 0)) __pyx_t_27 = 0;
12952  } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_27 = 0;
12953  if (unlikely(__pyx_t_27 != -1)) {
12954  __Pyx_RaiseBufferIndexError(__pyx_t_27);
12955  __PYX_ERR(0, 568, __pyx_L1_error)
12956  }
12957  __pyx_t_32 = __pyx_t_31;
12958  for (__pyx_t_27 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_rowptr.diminfo[0].strides)); __pyx_t_27 < __pyx_t_32; __pyx_t_27+=1) {
12959  __pyx_v_ii = __pyx_t_27;
12960 
12961  /* "subsurfaceTransportFunctions.pyx":569
12962  * elementResidual[eN,i] -= weight*f_up[I]*q_grad_w[eN,ebN,i,I]
12963  * for ii in range(rowptr[I],rowptr[I+1]):
12964  * elementResidual[eN,i] += weight*a_up[ii]*q_grad_u[eN,ebN,colind[ii]]*q_grad_w[eN,ebN,i,I] # <<<<<<<<<<<<<<
12965  * #I
12966  * #j
12967  */
12968  __pyx_t_21 = __pyx_v_ii;
12969  __pyx_t_33 = -1;
12970  if (__pyx_t_21 < 0) {
12971  __pyx_t_21 += __pyx_pybuffernd_a_up.diminfo[0].shape;
12972  if (unlikely(__pyx_t_21 < 0)) __pyx_t_33 = 0;
12973  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_a_up.diminfo[0].shape)) __pyx_t_33 = 0;
12974  if (unlikely(__pyx_t_33 != -1)) {
12975  __Pyx_RaiseBufferIndexError(__pyx_t_33);
12976  __PYX_ERR(0, 569, __pyx_L1_error)
12977  }
12978  __pyx_t_20 = __pyx_v_ii;
12979  __pyx_t_33 = -1;
12980  if (__pyx_t_20 < 0) {
12981  __pyx_t_20 += __pyx_pybuffernd_colind.diminfo[0].shape;
12982  if (unlikely(__pyx_t_20 < 0)) __pyx_t_33 = 0;
12983  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_colind.diminfo[0].shape)) __pyx_t_33 = 0;
12984  if (unlikely(__pyx_t_33 != -1)) {
12985  __Pyx_RaiseBufferIndexError(__pyx_t_33);
12986  __PYX_ERR(0, 569, __pyx_L1_error)
12987  }
12988  __pyx_t_7 = __pyx_v_eN;
12989  __pyx_t_15 = __pyx_v_ebN;
12990  __pyx_t_30 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_colind.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_colind.diminfo[0].strides));
12991  __pyx_t_33 = -1;
12992  if (__pyx_t_7 < 0) {
12993  __pyx_t_7 += __pyx_pybuffernd_q_grad_u.diminfo[0].shape;
12994  if (unlikely(__pyx_t_7 < 0)) __pyx_t_33 = 0;
12995  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_q_grad_u.diminfo[0].shape)) __pyx_t_33 = 0;
12996  if (__pyx_t_15 < 0) {
12997  __pyx_t_15 += __pyx_pybuffernd_q_grad_u.diminfo[1].shape;
12998  if (unlikely(__pyx_t_15 < 0)) __pyx_t_33 = 1;
12999  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_grad_u.diminfo[1].shape)) __pyx_t_33 = 1;
13000  if (__pyx_t_30 < 0) {
13001  __pyx_t_30 += __pyx_pybuffernd_q_grad_u.diminfo[2].shape;
13002  if (unlikely(__pyx_t_30 < 0)) __pyx_t_33 = 2;
13003  } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_q_grad_u.diminfo[2].shape)) __pyx_t_33 = 2;
13004  if (unlikely(__pyx_t_33 != -1)) {
13005  __Pyx_RaiseBufferIndexError(__pyx_t_33);
13006  __PYX_ERR(0, 569, __pyx_L1_error)
13007  }
13008  __pyx_t_29 = __pyx_v_eN;
13009  __pyx_t_34 = __pyx_v_ebN;
13010  __pyx_t_35 = __pyx_v_i;
13011  __pyx_t_36 = __pyx_v_I;
13012  __pyx_t_33 = -1;
13013  if (__pyx_t_29 < 0) {
13014  __pyx_t_29 += __pyx_pybuffernd_q_grad_w.diminfo[0].shape;
13015  if (unlikely(__pyx_t_29 < 0)) __pyx_t_33 = 0;
13016  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_q_grad_w.diminfo[0].shape)) __pyx_t_33 = 0;
13017  if (__pyx_t_34 < 0) {
13018  __pyx_t_34 += __pyx_pybuffernd_q_grad_w.diminfo[1].shape;
13019  if (unlikely(__pyx_t_34 < 0)) __pyx_t_33 = 1;
13020  } else if (unlikely(__pyx_t_34 >= __pyx_pybuffernd_q_grad_w.diminfo[1].shape)) __pyx_t_33 = 1;
13021  if (__pyx_t_35 < 0) {
13022  __pyx_t_35 += __pyx_pybuffernd_q_grad_w.diminfo[2].shape;
13023  if (unlikely(__pyx_t_35 < 0)) __pyx_t_33 = 2;
13024  } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_q_grad_w.diminfo[2].shape)) __pyx_t_33 = 2;
13025  if (__pyx_t_36 < 0) {
13026  __pyx_t_36 += __pyx_pybuffernd_q_grad_w.diminfo[3].shape;
13027  if (unlikely(__pyx_t_36 < 0)) __pyx_t_33 = 3;
13028  } else if (unlikely(__pyx_t_36 >= __pyx_pybuffernd_q_grad_w.diminfo[3].shape)) __pyx_t_33 = 3;
13029  if (unlikely(__pyx_t_33 != -1)) {
13030  __Pyx_RaiseBufferIndexError(__pyx_t_33);
13031  __PYX_ERR(0, 569, __pyx_L1_error)
13032  }
13033  __pyx_t_37 = __pyx_v_eN;
13034  __pyx_t_38 = __pyx_v_i;
13035  __pyx_t_33 = -1;
13036  if (__pyx_t_37 < 0) {
13037  __pyx_t_37 += __pyx_pybuffernd_elementResidual.diminfo[0].shape;
13038  if (unlikely(__pyx_t_37 < 0)) __pyx_t_33 = 0;
13039  } else if (unlikely(__pyx_t_37 >= __pyx_pybuffernd_elementResidual.diminfo[0].shape)) __pyx_t_33 = 0;
13040  if (__pyx_t_38 < 0) {
13041  __pyx_t_38 += __pyx_pybuffernd_elementResidual.diminfo[1].shape;
13042  if (unlikely(__pyx_t_38 < 0)) __pyx_t_33 = 1;
13043  } else if (unlikely(__pyx_t_38 >= __pyx_pybuffernd_elementResidual.diminfo[1].shape)) __pyx_t_33 = 1;
13044  if (unlikely(__pyx_t_33 != -1)) {
13045  __Pyx_RaiseBufferIndexError(__pyx_t_33);
13046  __PYX_ERR(0, 569, __pyx_L1_error)
13047  }
13048  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_elementResidual.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_elementResidual.diminfo[0].strides, __pyx_t_38, __pyx_pybuffernd_elementResidual.diminfo[1].strides) += (((__pyx_v_weight * (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_up.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_a_up.diminfo[0].strides))) * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_q_grad_u.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_q_grad_u.diminfo[1].strides, __pyx_t_30, __pyx_pybuffernd_q_grad_u.diminfo[2].strides))) * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_q_grad_w.diminfo[0].strides, __pyx_t_34, __pyx_pybuffernd_q_grad_w.diminfo[1].strides, __pyx_t_35, __pyx_pybuffernd_q_grad_w.diminfo[2].strides, __pyx_t_36, __pyx_pybuffernd_q_grad_w.diminfo[3].strides)));
13049  }
13050  }
13051  }
13052  }
13053  }
13054 
13055  /* "subsurfaceTransportFunctions.pyx":486
13056  * #eN for upwind
13057  *
13058  * def RE_NCP1_getElementResidual(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
13059  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
13060  * numpy.ndarray[ITYPE_t,ndim=1] colind,
13061  */
13062 
13063  /* function exit code */
13064  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
13065  goto __pyx_L0;
13066  __pyx_L1_error:;
13067  __Pyx_XDECREF(__pyx_t_1);
13068  __Pyx_XDECREF(__pyx_t_2);
13069  __Pyx_XDECREF(__pyx_t_4);
13070  __Pyx_XDECREF(__pyx_t_5);
13071  __Pyx_XDECREF(__pyx_t_9);
13072  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
13073  __Pyx_PyThreadState_declare
13074  __Pyx_PyThreadState_assign
13075  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
13076  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_up.rcbuffer->pybuffer);
13077  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_colind.rcbuffer->pybuffer);
13078  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer);
13079  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
13080  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementResidual.rcbuffer->pybuffer);
13081  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f_up.rcbuffer->pybuffer);
13082  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
13083  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer);
13084  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_detJ.rcbuffer->pybuffer);
13085  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer);
13086  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer);
13087  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer);
13088  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer);
13089  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer);
13090  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_m.rcbuffer->pybuffer);
13091  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_mt.rcbuffer->pybuffer);
13092  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer);
13093  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer);
13094  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer);
13095  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
13096  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_getElementResidual", __pyx_clineno, __pyx_lineno, __pyx_filename);
13097  __pyx_r = NULL;
13098  goto __pyx_L2;
13099  __pyx_L0:;
13100  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_up.rcbuffer->pybuffer);
13101  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_colind.rcbuffer->pybuffer);
13102  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer);
13103  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
13104  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementResidual.rcbuffer->pybuffer);
13105  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f_up.rcbuffer->pybuffer);
13106  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
13107  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer);
13108  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_detJ.rcbuffer->pybuffer);
13109  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer);
13110  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer);
13111  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer);
13112  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer);
13113  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer);
13114  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_m.rcbuffer->pybuffer);
13115  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_mt.rcbuffer->pybuffer);
13116  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer);
13117  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer);
13118  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer);
13119  __pyx_L2:;
13120  __Pyx_XDECREF(__pyx_v_q);
13121  __Pyx_XDECREF((PyObject *)__pyx_v_a_up);
13122  __Pyx_XDECREF((PyObject *)__pyx_v_f_up);
13123  __Pyx_XGIVEREF(__pyx_r);
13124  __Pyx_RefNannyFinishContext();
13125  return __pyx_r;
13126 }
13127 
13128 /* "subsurfaceTransportFunctions.pyx":574
13129  * #i
13130  * #eN
13131  * def RE_NCP1_getElementJacobian(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
13132  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
13133  * numpy.ndarray[ITYPE_t,ndim=1] colind,
13134  */
13135 
13136 /* Python wrapper */
13137 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_35RE_NCP1_getElementJacobian(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
13138 static char __pyx_doc_28subsurfaceTransportFunctions_34RE_NCP1_getElementJacobian[] = "\n residual routine for NCP1 approximation for conservative head formulation of Richards equation \n\n Approximation:\n uses nodal quadrature where the nodes are face barycenters\n uses harmonic average for intrinsic permeability/ hydraulic conductivity\n upwinds relative permeability based on element averages\n applies dirichlet boundary conditions strongly but keeps dofs in system\n\n TODO:\n everything\n \n ";
13139 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_35RE_NCP1_getElementJacobian = {"RE_NCP1_getElementJacobian", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_35RE_NCP1_getElementJacobian, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_34RE_NCP1_getElementJacobian};
13140 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_35RE_NCP1_getElementJacobian(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
13141  CYTHON_UNUSED PyArrayObject *__pyx_v_gravity = 0;
13142  PyArrayObject *__pyx_v_rowptr = 0;
13143  PyArrayObject *__pyx_v_colind = 0;
13144  int __pyx_v_nSpace;
13145  int __pyx_v_nElements_global;
13146  int __pyx_v_nElementBoundaries_element;
13147  CYTHON_UNUSED PyArrayObject *__pyx_v_elementNeighborsArray = 0;
13148  CYTHON_UNUSED PyArrayObject *__pyx_v_elementBarycentersArray = 0;
13149  int __pyx_v_nDOF_test_element;
13150  int __pyx_v_nDOF_trial_element;
13151  PyArrayObject *__pyx_v_q_u = 0;
13152  CYTHON_UNUSED PyArrayObject *__pyx_v_q_grad_u = 0;
13153  PyArrayObject *__pyx_v_q_grad_w = 0;
13154  PyArrayObject *__pyx_v_q_grad_v = 0;
13155  PyArrayObject *__pyx_v_q_detJ = 0;
13156  PyArrayObject *__pyx_v_q_m = 0;
13157  CYTHON_UNUSED PyArrayObject *__pyx_v_q_dm = 0;
13158  PyArrayObject *__pyx_v_q_mt = 0;
13159  PyArrayObject *__pyx_v_q_dmt = 0;
13160  PyArrayObject *__pyx_v_q_r = 0;
13161  PyArrayObject *__pyx_v_q_kr = 0;
13162  CYTHON_UNUSED PyArrayObject *__pyx_v_q_dkr = 0;
13163  PyArrayObject *__pyx_v_q_kr_up = 0;
13164  PyArrayObject *__pyx_v_q_flin = 0;
13165  PyArrayObject *__pyx_v_q_alin = 0;
13166  PyArrayObject *__pyx_v_elementJacobian = 0;
13167  int __pyx_lineno = 0;
13168  const char *__pyx_filename = NULL;
13169  int __pyx_clineno = 0;
13170  PyObject *__pyx_r = 0;
13171  __Pyx_RefNannyDeclarations
13172  __Pyx_RefNannySetupContext("RE_NCP1_getElementJacobian (wrapper)", 0);
13173  {
13174  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_gravity,&__pyx_n_s_rowptr,&__pyx_n_s_colind,&__pyx_n_s_nSpace,&__pyx_n_s_nElements_global,&__pyx_n_s_nElementBoundaries_element,&__pyx_n_s_elementNeighborsArray,&__pyx_n_s_elementBarycentersArray,&__pyx_n_s_nDOF_test_element,&__pyx_n_s_nDOF_trial_element,&__pyx_n_s_q_u,&__pyx_n_s_q_grad_u,&__pyx_n_s_q_grad_w,&__pyx_n_s_q_grad_v,&__pyx_n_s_q_detJ,&__pyx_n_s_q_m,&__pyx_n_s_q_dm,&__pyx_n_s_q_mt,&__pyx_n_s_q_dmt,&__pyx_n_s_q_r,&__pyx_n_s_q_kr,&__pyx_n_s_q_dkr,&__pyx_n_s_q_kr_up,&__pyx_n_s_q_flin,&__pyx_n_s_q_alin,&__pyx_n_s_elementJacobian,0};
13175  PyObject* values[26] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
13176  if (unlikely(__pyx_kwds)) {
13177  Py_ssize_t kw_args;
13178  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
13179  switch (pos_args) {
13180  case 26: values[25] = PyTuple_GET_ITEM(__pyx_args, 25);
13181  CYTHON_FALLTHROUGH;
13182  case 25: values[24] = PyTuple_GET_ITEM(__pyx_args, 24);
13183  CYTHON_FALLTHROUGH;
13184  case 24: values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
13185  CYTHON_FALLTHROUGH;
13186  case 23: values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
13187  CYTHON_FALLTHROUGH;
13188  case 22: values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
13189  CYTHON_FALLTHROUGH;
13190  case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
13191  CYTHON_FALLTHROUGH;
13192  case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
13193  CYTHON_FALLTHROUGH;
13194  case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
13195  CYTHON_FALLTHROUGH;
13196  case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
13197  CYTHON_FALLTHROUGH;
13198  case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
13199  CYTHON_FALLTHROUGH;
13200  case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
13201  CYTHON_FALLTHROUGH;
13202  case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
13203  CYTHON_FALLTHROUGH;
13204  case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
13205  CYTHON_FALLTHROUGH;
13206  case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
13207  CYTHON_FALLTHROUGH;
13208  case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
13209  CYTHON_FALLTHROUGH;
13210  case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
13211  CYTHON_FALLTHROUGH;
13212  case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
13213  CYTHON_FALLTHROUGH;
13214  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
13215  CYTHON_FALLTHROUGH;
13216  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
13217  CYTHON_FALLTHROUGH;
13218  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
13219  CYTHON_FALLTHROUGH;
13220  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
13221  CYTHON_FALLTHROUGH;
13222  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
13223  CYTHON_FALLTHROUGH;
13224  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
13225  CYTHON_FALLTHROUGH;
13226  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
13227  CYTHON_FALLTHROUGH;
13228  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
13229  CYTHON_FALLTHROUGH;
13230  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
13231  CYTHON_FALLTHROUGH;
13232  case 0: break;
13233  default: goto __pyx_L5_argtuple_error;
13234  }
13235  kw_args = PyDict_Size(__pyx_kwds);
13236  switch (pos_args) {
13237  case 0:
13238  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gravity)) != 0)) kw_args--;
13239  else goto __pyx_L5_argtuple_error;
13240  CYTHON_FALLTHROUGH;
13241  case 1:
13242  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rowptr)) != 0)) kw_args--;
13243  else {
13244  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 1); __PYX_ERR(0, 574, __pyx_L3_error)
13245  }
13246  CYTHON_FALLTHROUGH;
13247  case 2:
13248  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_colind)) != 0)) kw_args--;
13249  else {
13250  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 2); __PYX_ERR(0, 574, __pyx_L3_error)
13251  }
13252  CYTHON_FALLTHROUGH;
13253  case 3:
13254  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nSpace)) != 0)) kw_args--;
13255  else {
13256  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 3); __PYX_ERR(0, 574, __pyx_L3_error)
13257  }
13258  CYTHON_FALLTHROUGH;
13259  case 4:
13260  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElements_global)) != 0)) kw_args--;
13261  else {
13262  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 4); __PYX_ERR(0, 574, __pyx_L3_error)
13263  }
13264  CYTHON_FALLTHROUGH;
13265  case 5:
13266  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElementBoundaries_element)) != 0)) kw_args--;
13267  else {
13268  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 5); __PYX_ERR(0, 574, __pyx_L3_error)
13269  }
13270  CYTHON_FALLTHROUGH;
13271  case 6:
13272  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementNeighborsArray)) != 0)) kw_args--;
13273  else {
13274  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 6); __PYX_ERR(0, 574, __pyx_L3_error)
13275  }
13276  CYTHON_FALLTHROUGH;
13277  case 7:
13278  if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBarycentersArray)) != 0)) kw_args--;
13279  else {
13280  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 7); __PYX_ERR(0, 574, __pyx_L3_error)
13281  }
13282  CYTHON_FALLTHROUGH;
13283  case 8:
13284  if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nDOF_test_element)) != 0)) kw_args--;
13285  else {
13286  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 8); __PYX_ERR(0, 574, __pyx_L3_error)
13287  }
13288  CYTHON_FALLTHROUGH;
13289  case 9:
13290  if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nDOF_trial_element)) != 0)) kw_args--;
13291  else {
13292  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 9); __PYX_ERR(0, 574, __pyx_L3_error)
13293  }
13294  CYTHON_FALLTHROUGH;
13295  case 10:
13296  if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_u)) != 0)) kw_args--;
13297  else {
13298  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 10); __PYX_ERR(0, 574, __pyx_L3_error)
13299  }
13300  CYTHON_FALLTHROUGH;
13301  case 11:
13302  if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_grad_u)) != 0)) kw_args--;
13303  else {
13304  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 11); __PYX_ERR(0, 574, __pyx_L3_error)
13305  }
13306  CYTHON_FALLTHROUGH;
13307  case 12:
13308  if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_grad_w)) != 0)) kw_args--;
13309  else {
13310  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 12); __PYX_ERR(0, 574, __pyx_L3_error)
13311  }
13312  CYTHON_FALLTHROUGH;
13313  case 13:
13314  if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_grad_v)) != 0)) kw_args--;
13315  else {
13316  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 13); __PYX_ERR(0, 574, __pyx_L3_error)
13317  }
13318  CYTHON_FALLTHROUGH;
13319  case 14:
13320  if (likely((values[14] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_detJ)) != 0)) kw_args--;
13321  else {
13322  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 14); __PYX_ERR(0, 574, __pyx_L3_error)
13323  }
13324  CYTHON_FALLTHROUGH;
13325  case 15:
13326  if (likely((values[15] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_m)) != 0)) kw_args--;
13327  else {
13328  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 15); __PYX_ERR(0, 574, __pyx_L3_error)
13329  }
13330  CYTHON_FALLTHROUGH;
13331  case 16:
13332  if (likely((values[16] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_dm)) != 0)) kw_args--;
13333  else {
13334  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 16); __PYX_ERR(0, 574, __pyx_L3_error)
13335  }
13336  CYTHON_FALLTHROUGH;
13337  case 17:
13338  if (likely((values[17] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_mt)) != 0)) kw_args--;
13339  else {
13340  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 17); __PYX_ERR(0, 574, __pyx_L3_error)
13341  }
13342  CYTHON_FALLTHROUGH;
13343  case 18:
13344  if (likely((values[18] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_dmt)) != 0)) kw_args--;
13345  else {
13346  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 18); __PYX_ERR(0, 574, __pyx_L3_error)
13347  }
13348  CYTHON_FALLTHROUGH;
13349  case 19:
13350  if (likely((values[19] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_r)) != 0)) kw_args--;
13351  else {
13352  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 19); __PYX_ERR(0, 574, __pyx_L3_error)
13353  }
13354  CYTHON_FALLTHROUGH;
13355  case 20:
13356  if (likely((values[20] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_kr)) != 0)) kw_args--;
13357  else {
13358  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 20); __PYX_ERR(0, 574, __pyx_L3_error)
13359  }
13360  CYTHON_FALLTHROUGH;
13361  case 21:
13362  if (likely((values[21] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_dkr)) != 0)) kw_args--;
13363  else {
13364  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 21); __PYX_ERR(0, 574, __pyx_L3_error)
13365  }
13366  CYTHON_FALLTHROUGH;
13367  case 22:
13368  if (likely((values[22] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_kr_up)) != 0)) kw_args--;
13369  else {
13370  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 22); __PYX_ERR(0, 574, __pyx_L3_error)
13371  }
13372  CYTHON_FALLTHROUGH;
13373  case 23:
13374  if (likely((values[23] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_flin)) != 0)) kw_args--;
13375  else {
13376  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 23); __PYX_ERR(0, 574, __pyx_L3_error)
13377  }
13378  CYTHON_FALLTHROUGH;
13379  case 24:
13380  if (likely((values[24] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_q_alin)) != 0)) kw_args--;
13381  else {
13382  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 24); __PYX_ERR(0, 574, __pyx_L3_error)
13383  }
13384  CYTHON_FALLTHROUGH;
13385  case 25:
13386  if (likely((values[25] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementJacobian)) != 0)) kw_args--;
13387  else {
13388  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, 25); __PYX_ERR(0, 574, __pyx_L3_error)
13389  }
13390  }
13391  if (unlikely(kw_args > 0)) {
13392  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "RE_NCP1_getElementJacobian") < 0)) __PYX_ERR(0, 574, __pyx_L3_error)
13393  }
13394  } else if (PyTuple_GET_SIZE(__pyx_args) != 26) {
13395  goto __pyx_L5_argtuple_error;
13396  } else {
13397  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
13398  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
13399  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
13400  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
13401  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
13402  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
13403  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
13404  values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
13405  values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
13406  values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
13407  values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
13408  values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
13409  values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
13410  values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
13411  values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
13412  values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
13413  values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
13414  values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
13415  values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
13416  values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
13417  values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
13418  values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
13419  values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
13420  values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
13421  values[24] = PyTuple_GET_ITEM(__pyx_args, 24);
13422  values[25] = PyTuple_GET_ITEM(__pyx_args, 25);
13423  }
13424  __pyx_v_gravity = ((PyArrayObject *)values[0]);
13425  __pyx_v_rowptr = ((PyArrayObject *)values[1]);
13426  __pyx_v_colind = ((PyArrayObject *)values[2]);
13427  __pyx_v_nSpace = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_nSpace == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 578, __pyx_L3_error)
13428  __pyx_v_nElements_global = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_nElements_global == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 579, __pyx_L3_error)
13429  __pyx_v_nElementBoundaries_element = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_nElementBoundaries_element == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 580, __pyx_L3_error)
13430  __pyx_v_elementNeighborsArray = ((PyArrayObject *)values[6]);
13431  __pyx_v_elementBarycentersArray = ((PyArrayObject *)values[7]);
13432  __pyx_v_nDOF_test_element = __Pyx_PyInt_As_int(values[8]); if (unlikely((__pyx_v_nDOF_test_element == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 584, __pyx_L3_error)
13433  __pyx_v_nDOF_trial_element = __Pyx_PyInt_As_int(values[9]); if (unlikely((__pyx_v_nDOF_trial_element == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 585, __pyx_L3_error)
13434  __pyx_v_q_u = ((PyArrayObject *)values[10]);
13435  __pyx_v_q_grad_u = ((PyArrayObject *)values[11]);
13436  __pyx_v_q_grad_w = ((PyArrayObject *)values[12]);
13437  __pyx_v_q_grad_v = ((PyArrayObject *)values[13]);
13438  __pyx_v_q_detJ = ((PyArrayObject *)values[14]);
13439  __pyx_v_q_m = ((PyArrayObject *)values[15]);
13440  __pyx_v_q_dm = ((PyArrayObject *)values[16]);
13441  __pyx_v_q_mt = ((PyArrayObject *)values[17]);
13442  __pyx_v_q_dmt = ((PyArrayObject *)values[18]);
13443  __pyx_v_q_r = ((PyArrayObject *)values[19]);
13444  __pyx_v_q_kr = ((PyArrayObject *)values[20]);
13445  __pyx_v_q_dkr = ((PyArrayObject *)values[21]);
13446  __pyx_v_q_kr_up = ((PyArrayObject *)values[22]);
13447  __pyx_v_q_flin = ((PyArrayObject *)values[23]);
13448  __pyx_v_q_alin = ((PyArrayObject *)values[24]);
13449  __pyx_v_elementJacobian = ((PyArrayObject *)values[25]);
13450  }
13451  goto __pyx_L4_argument_unpacking_done;
13452  __pyx_L5_argtuple_error:;
13453  __Pyx_RaiseArgtupleInvalid("RE_NCP1_getElementJacobian", 1, 26, 26, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 574, __pyx_L3_error)
13454  __pyx_L3_error:;
13455  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_getElementJacobian", __pyx_clineno, __pyx_lineno, __pyx_filename);
13456  __Pyx_RefNannyFinishContext();
13457  return NULL;
13458  __pyx_L4_argument_unpacking_done:;
13459  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gravity), __pyx_ptype_5numpy_ndarray, 1, "gravity", 0))) __PYX_ERR(0, 574, __pyx_L1_error)
13460  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_rowptr), __pyx_ptype_5numpy_ndarray, 1, "rowptr", 0))) __PYX_ERR(0, 575, __pyx_L1_error)
13461  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_colind), __pyx_ptype_5numpy_ndarray, 1, "colind", 0))) __PYX_ERR(0, 576, __pyx_L1_error)
13462  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementNeighborsArray), __pyx_ptype_5numpy_ndarray, 1, "elementNeighborsArray", 0))) __PYX_ERR(0, 581, __pyx_L1_error)
13463  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementBarycentersArray), __pyx_ptype_5numpy_ndarray, 1, "elementBarycentersArray", 0))) __PYX_ERR(0, 582, __pyx_L1_error)
13464  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_u), __pyx_ptype_5numpy_ndarray, 1, "q_u", 0))) __PYX_ERR(0, 586, __pyx_L1_error)
13465  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_grad_u), __pyx_ptype_5numpy_ndarray, 1, "q_grad_u", 0))) __PYX_ERR(0, 587, __pyx_L1_error)
13466  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_grad_w), __pyx_ptype_5numpy_ndarray, 1, "q_grad_w", 0))) __PYX_ERR(0, 588, __pyx_L1_error)
13467  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_grad_v), __pyx_ptype_5numpy_ndarray, 1, "q_grad_v", 0))) __PYX_ERR(0, 589, __pyx_L1_error)
13468  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_detJ), __pyx_ptype_5numpy_ndarray, 1, "q_detJ", 0))) __PYX_ERR(0, 591, __pyx_L1_error)
13469  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_m), __pyx_ptype_5numpy_ndarray, 1, "q_m", 0))) __PYX_ERR(0, 592, __pyx_L1_error)
13470  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_dm), __pyx_ptype_5numpy_ndarray, 1, "q_dm", 0))) __PYX_ERR(0, 593, __pyx_L1_error)
13471  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_mt), __pyx_ptype_5numpy_ndarray, 1, "q_mt", 0))) __PYX_ERR(0, 594, __pyx_L1_error)
13472  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_dmt), __pyx_ptype_5numpy_ndarray, 1, "q_dmt", 0))) __PYX_ERR(0, 595, __pyx_L1_error)
13473  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_r), __pyx_ptype_5numpy_ndarray, 1, "q_r", 0))) __PYX_ERR(0, 596, __pyx_L1_error)
13474  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_kr), __pyx_ptype_5numpy_ndarray, 1, "q_kr", 0))) __PYX_ERR(0, 597, __pyx_L1_error)
13475  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_dkr), __pyx_ptype_5numpy_ndarray, 1, "q_dkr", 0))) __PYX_ERR(0, 598, __pyx_L1_error)
13476  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_kr_up), __pyx_ptype_5numpy_ndarray, 1, "q_kr_up", 0))) __PYX_ERR(0, 599, __pyx_L1_error)
13477  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_flin), __pyx_ptype_5numpy_ndarray, 1, "q_flin", 0))) __PYX_ERR(0, 602, __pyx_L1_error)
13478  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q_alin), __pyx_ptype_5numpy_ndarray, 1, "q_alin", 0))) __PYX_ERR(0, 603, __pyx_L1_error)
13479  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_elementJacobian), __pyx_ptype_5numpy_ndarray, 1, "elementJacobian", 0))) __PYX_ERR(0, 605, __pyx_L1_error)
13480  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_34RE_NCP1_getElementJacobian(__pyx_self, __pyx_v_gravity, __pyx_v_rowptr, __pyx_v_colind, __pyx_v_nSpace, __pyx_v_nElements_global, __pyx_v_nElementBoundaries_element, __pyx_v_elementNeighborsArray, __pyx_v_elementBarycentersArray, __pyx_v_nDOF_test_element, __pyx_v_nDOF_trial_element, __pyx_v_q_u, __pyx_v_q_grad_u, __pyx_v_q_grad_w, __pyx_v_q_grad_v, __pyx_v_q_detJ, __pyx_v_q_m, __pyx_v_q_dm, __pyx_v_q_mt, __pyx_v_q_dmt, __pyx_v_q_r, __pyx_v_q_kr, __pyx_v_q_dkr, __pyx_v_q_kr_up, __pyx_v_q_flin, __pyx_v_q_alin, __pyx_v_elementJacobian);
13481 
13482  /* function exit code */
13483  goto __pyx_L0;
13484  __pyx_L1_error:;
13485  __pyx_r = NULL;
13486  __pyx_L0:;
13487  __Pyx_RefNannyFinishContext();
13488  return __pyx_r;
13489 }
13490 
13491 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_34RE_NCP1_getElementJacobian(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyArrayObject *__pyx_v_gravity, PyArrayObject *__pyx_v_rowptr, PyArrayObject *__pyx_v_colind, int __pyx_v_nSpace, int __pyx_v_nElements_global, int __pyx_v_nElementBoundaries_element, CYTHON_UNUSED PyArrayObject *__pyx_v_elementNeighborsArray, CYTHON_UNUSED PyArrayObject *__pyx_v_elementBarycentersArray, int __pyx_v_nDOF_test_element, int __pyx_v_nDOF_trial_element, PyArrayObject *__pyx_v_q_u, CYTHON_UNUSED PyArrayObject *__pyx_v_q_grad_u, PyArrayObject *__pyx_v_q_grad_w, PyArrayObject *__pyx_v_q_grad_v, PyArrayObject *__pyx_v_q_detJ, PyArrayObject *__pyx_v_q_m, CYTHON_UNUSED PyArrayObject *__pyx_v_q_dm, PyArrayObject *__pyx_v_q_mt, PyArrayObject *__pyx_v_q_dmt, PyArrayObject *__pyx_v_q_r, PyArrayObject *__pyx_v_q_kr, CYTHON_UNUSED PyArrayObject *__pyx_v_q_dkr, PyArrayObject *__pyx_v_q_kr_up, PyArrayObject *__pyx_v_q_flin, PyArrayObject *__pyx_v_q_alin, PyArrayObject *__pyx_v_elementJacobian) {
13492  CYTHON_UNUSED int __pyx_v_upwindFlag;
13493  CYTHON_UNUSED int __pyx_v_picard;
13494  PyObject *__pyx_v_q = NULL;
13495  int __pyx_v_nnz;
13496  int __pyx_v_eN;
13497  int __pyx_v_ii;
13498  int __pyx_v_I;
13499  PyArrayObject *__pyx_v_a_up = 0;
13500  PyArrayObject *__pyx_v_f_up = 0;
13501  double __pyx_v_nAvgWeight;
13502  double __pyx_v_weight;
13503  double __pyx_v_volFactor;
13504  CYTHON_UNUSED int __pyx_v_thisElementIsUpwind;
13505  double __pyx_v_volume;
13506  int __pyx_v_i;
13507  int __pyx_v_ebN;
13508  int __pyx_v_j;
13509  __Pyx_LocalBuf_ND __pyx_pybuffernd_a_up;
13510  __Pyx_Buffer __pyx_pybuffer_a_up;
13511  __Pyx_LocalBuf_ND __pyx_pybuffernd_colind;
13512  __Pyx_Buffer __pyx_pybuffer_colind;
13513  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementBarycentersArray;
13514  __Pyx_Buffer __pyx_pybuffer_elementBarycentersArray;
13515  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementJacobian;
13516  __Pyx_Buffer __pyx_pybuffer_elementJacobian;
13517  __Pyx_LocalBuf_ND __pyx_pybuffernd_elementNeighborsArray;
13518  __Pyx_Buffer __pyx_pybuffer_elementNeighborsArray;
13519  __Pyx_LocalBuf_ND __pyx_pybuffernd_f_up;
13520  __Pyx_Buffer __pyx_pybuffer_f_up;
13521  __Pyx_LocalBuf_ND __pyx_pybuffernd_gravity;
13522  __Pyx_Buffer __pyx_pybuffer_gravity;
13523  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_alin;
13524  __Pyx_Buffer __pyx_pybuffer_q_alin;
13525  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_detJ;
13526  __Pyx_Buffer __pyx_pybuffer_q_detJ;
13527  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_dkr;
13528  __Pyx_Buffer __pyx_pybuffer_q_dkr;
13529  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_dm;
13530  __Pyx_Buffer __pyx_pybuffer_q_dm;
13531  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_dmt;
13532  __Pyx_Buffer __pyx_pybuffer_q_dmt;
13533  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_flin;
13534  __Pyx_Buffer __pyx_pybuffer_q_flin;
13535  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_grad_u;
13536  __Pyx_Buffer __pyx_pybuffer_q_grad_u;
13537  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_grad_v;
13538  __Pyx_Buffer __pyx_pybuffer_q_grad_v;
13539  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_grad_w;
13540  __Pyx_Buffer __pyx_pybuffer_q_grad_w;
13541  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_kr;
13542  __Pyx_Buffer __pyx_pybuffer_q_kr;
13543  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_kr_up;
13544  __Pyx_Buffer __pyx_pybuffer_q_kr_up;
13545  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_m;
13546  __Pyx_Buffer __pyx_pybuffer_q_m;
13547  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_mt;
13548  __Pyx_Buffer __pyx_pybuffer_q_mt;
13549  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_r;
13550  __Pyx_Buffer __pyx_pybuffer_q_r;
13551  __Pyx_LocalBuf_ND __pyx_pybuffernd_q_u;
13552  __Pyx_Buffer __pyx_pybuffer_q_u;
13553  __Pyx_LocalBuf_ND __pyx_pybuffernd_rowptr;
13554  __Pyx_Buffer __pyx_pybuffer_rowptr;
13555  PyObject *__pyx_r = NULL;
13556  __Pyx_RefNannyDeclarations
13557  PyObject *__pyx_t_1 = NULL;
13558  PyObject *__pyx_t_2 = NULL;
13559  Py_ssize_t __pyx_t_3;
13560  PyObject *__pyx_t_4 = NULL;
13561  PyObject *__pyx_t_5 = NULL;
13562  int __pyx_t_6;
13563  Py_ssize_t __pyx_t_7;
13564  int __pyx_t_8;
13565  PyObject *__pyx_t_9 = NULL;
13566  PyArrayObject *__pyx_t_10 = NULL;
13567  PyArrayObject *__pyx_t_11 = NULL;
13568  double __pyx_t_12;
13569  int __pyx_t_13;
13570  int __pyx_t_14;
13571  Py_ssize_t __pyx_t_15;
13572  int __pyx_t_16;
13573  int __pyx_t_17;
13574  int __pyx_t_18;
13575  int __pyx_t_19;
13576  Py_ssize_t __pyx_t_20;
13577  Py_ssize_t __pyx_t_21;
13578  Py_ssize_t __pyx_t_22;
13579  int __pyx_t_23;
13580  int __pyx_t_24;
13581  int __pyx_t_25;
13582  int __pyx_t_26;
13583  int __pyx_t_27;
13584  int __pyx_t_28;
13585  Py_ssize_t __pyx_t_29;
13586  int __pyx_t_30;
13587  int __pyx_t_31;
13588  int __pyx_t_32;
13589  __pyx_t_28subsurfaceTransportFunctions_ITYPE_t __pyx_t_33;
13590  __pyx_t_28subsurfaceTransportFunctions_ITYPE_t __pyx_t_34;
13591  int __pyx_t_35;
13592  Py_ssize_t __pyx_t_36;
13593  Py_ssize_t __pyx_t_37;
13594  Py_ssize_t __pyx_t_38;
13595  Py_ssize_t __pyx_t_39;
13596  Py_ssize_t __pyx_t_40;
13597  Py_ssize_t __pyx_t_41;
13598  Py_ssize_t __pyx_t_42;
13599  Py_ssize_t __pyx_t_43;
13600  int __pyx_lineno = 0;
13601  const char *__pyx_filename = NULL;
13602  int __pyx_clineno = 0;
13603  __Pyx_RefNannySetupContext("RE_NCP1_getElementJacobian", 0);
13604  __pyx_pybuffer_a_up.pybuffer.buf = NULL;
13605  __pyx_pybuffer_a_up.refcount = 0;
13606  __pyx_pybuffernd_a_up.data = NULL;
13607  __pyx_pybuffernd_a_up.rcbuffer = &__pyx_pybuffer_a_up;
13608  __pyx_pybuffer_f_up.pybuffer.buf = NULL;
13609  __pyx_pybuffer_f_up.refcount = 0;
13610  __pyx_pybuffernd_f_up.data = NULL;
13611  __pyx_pybuffernd_f_up.rcbuffer = &__pyx_pybuffer_f_up;
13612  __pyx_pybuffer_gravity.pybuffer.buf = NULL;
13613  __pyx_pybuffer_gravity.refcount = 0;
13614  __pyx_pybuffernd_gravity.data = NULL;
13615  __pyx_pybuffernd_gravity.rcbuffer = &__pyx_pybuffer_gravity;
13616  __pyx_pybuffer_rowptr.pybuffer.buf = NULL;
13617  __pyx_pybuffer_rowptr.refcount = 0;
13618  __pyx_pybuffernd_rowptr.data = NULL;
13619  __pyx_pybuffernd_rowptr.rcbuffer = &__pyx_pybuffer_rowptr;
13620  __pyx_pybuffer_colind.pybuffer.buf = NULL;
13621  __pyx_pybuffer_colind.refcount = 0;
13622  __pyx_pybuffernd_colind.data = NULL;
13623  __pyx_pybuffernd_colind.rcbuffer = &__pyx_pybuffer_colind;
13624  __pyx_pybuffer_elementNeighborsArray.pybuffer.buf = NULL;
13625  __pyx_pybuffer_elementNeighborsArray.refcount = 0;
13626  __pyx_pybuffernd_elementNeighborsArray.data = NULL;
13627  __pyx_pybuffernd_elementNeighborsArray.rcbuffer = &__pyx_pybuffer_elementNeighborsArray;
13628  __pyx_pybuffer_elementBarycentersArray.pybuffer.buf = NULL;
13629  __pyx_pybuffer_elementBarycentersArray.refcount = 0;
13630  __pyx_pybuffernd_elementBarycentersArray.data = NULL;
13631  __pyx_pybuffernd_elementBarycentersArray.rcbuffer = &__pyx_pybuffer_elementBarycentersArray;
13632  __pyx_pybuffer_q_u.pybuffer.buf = NULL;
13633  __pyx_pybuffer_q_u.refcount = 0;
13634  __pyx_pybuffernd_q_u.data = NULL;
13635  __pyx_pybuffernd_q_u.rcbuffer = &__pyx_pybuffer_q_u;
13636  __pyx_pybuffer_q_grad_u.pybuffer.buf = NULL;
13637  __pyx_pybuffer_q_grad_u.refcount = 0;
13638  __pyx_pybuffernd_q_grad_u.data = NULL;
13639  __pyx_pybuffernd_q_grad_u.rcbuffer = &__pyx_pybuffer_q_grad_u;
13640  __pyx_pybuffer_q_grad_w.pybuffer.buf = NULL;
13641  __pyx_pybuffer_q_grad_w.refcount = 0;
13642  __pyx_pybuffernd_q_grad_w.data = NULL;
13643  __pyx_pybuffernd_q_grad_w.rcbuffer = &__pyx_pybuffer_q_grad_w;
13644  __pyx_pybuffer_q_grad_v.pybuffer.buf = NULL;
13645  __pyx_pybuffer_q_grad_v.refcount = 0;
13646  __pyx_pybuffernd_q_grad_v.data = NULL;
13647  __pyx_pybuffernd_q_grad_v.rcbuffer = &__pyx_pybuffer_q_grad_v;
13648  __pyx_pybuffer_q_detJ.pybuffer.buf = NULL;
13649  __pyx_pybuffer_q_detJ.refcount = 0;
13650  __pyx_pybuffernd_q_detJ.data = NULL;
13651  __pyx_pybuffernd_q_detJ.rcbuffer = &__pyx_pybuffer_q_detJ;
13652  __pyx_pybuffer_q_m.pybuffer.buf = NULL;
13653  __pyx_pybuffer_q_m.refcount = 0;
13654  __pyx_pybuffernd_q_m.data = NULL;
13655  __pyx_pybuffernd_q_m.rcbuffer = &__pyx_pybuffer_q_m;
13656  __pyx_pybuffer_q_dm.pybuffer.buf = NULL;
13657  __pyx_pybuffer_q_dm.refcount = 0;
13658  __pyx_pybuffernd_q_dm.data = NULL;
13659  __pyx_pybuffernd_q_dm.rcbuffer = &__pyx_pybuffer_q_dm;
13660  __pyx_pybuffer_q_mt.pybuffer.buf = NULL;
13661  __pyx_pybuffer_q_mt.refcount = 0;
13662  __pyx_pybuffernd_q_mt.data = NULL;
13663  __pyx_pybuffernd_q_mt.rcbuffer = &__pyx_pybuffer_q_mt;
13664  __pyx_pybuffer_q_dmt.pybuffer.buf = NULL;
13665  __pyx_pybuffer_q_dmt.refcount = 0;
13666  __pyx_pybuffernd_q_dmt.data = NULL;
13667  __pyx_pybuffernd_q_dmt.rcbuffer = &__pyx_pybuffer_q_dmt;
13668  __pyx_pybuffer_q_r.pybuffer.buf = NULL;
13669  __pyx_pybuffer_q_r.refcount = 0;
13670  __pyx_pybuffernd_q_r.data = NULL;
13671  __pyx_pybuffernd_q_r.rcbuffer = &__pyx_pybuffer_q_r;
13672  __pyx_pybuffer_q_kr.pybuffer.buf = NULL;
13673  __pyx_pybuffer_q_kr.refcount = 0;
13674  __pyx_pybuffernd_q_kr.data = NULL;
13675  __pyx_pybuffernd_q_kr.rcbuffer = &__pyx_pybuffer_q_kr;
13676  __pyx_pybuffer_q_dkr.pybuffer.buf = NULL;
13677  __pyx_pybuffer_q_dkr.refcount = 0;
13678  __pyx_pybuffernd_q_dkr.data = NULL;
13679  __pyx_pybuffernd_q_dkr.rcbuffer = &__pyx_pybuffer_q_dkr;
13680  __pyx_pybuffer_q_kr_up.pybuffer.buf = NULL;
13681  __pyx_pybuffer_q_kr_up.refcount = 0;
13682  __pyx_pybuffernd_q_kr_up.data = NULL;
13683  __pyx_pybuffernd_q_kr_up.rcbuffer = &__pyx_pybuffer_q_kr_up;
13684  __pyx_pybuffer_q_flin.pybuffer.buf = NULL;
13685  __pyx_pybuffer_q_flin.refcount = 0;
13686  __pyx_pybuffernd_q_flin.data = NULL;
13687  __pyx_pybuffernd_q_flin.rcbuffer = &__pyx_pybuffer_q_flin;
13688  __pyx_pybuffer_q_alin.pybuffer.buf = NULL;
13689  __pyx_pybuffer_q_alin.refcount = 0;
13690  __pyx_pybuffernd_q_alin.data = NULL;
13691  __pyx_pybuffernd_q_alin.rcbuffer = &__pyx_pybuffer_q_alin;
13692  __pyx_pybuffer_elementJacobian.pybuffer.buf = NULL;
13693  __pyx_pybuffer_elementJacobian.refcount = 0;
13694  __pyx_pybuffernd_elementJacobian.data = NULL;
13695  __pyx_pybuffernd_elementJacobian.rcbuffer = &__pyx_pybuffer_elementJacobian;
13696  {
13697  __Pyx_BufFmt_StackElem __pyx_stack[1];
13698  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer, (PyObject*)__pyx_v_gravity, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13699  }
13700  __pyx_pybuffernd_gravity.diminfo[0].strides = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_gravity.diminfo[0].shape = __pyx_pybuffernd_gravity.rcbuffer->pybuffer.shape[0];
13701  {
13702  __Pyx_BufFmt_StackElem __pyx_stack[1];
13703  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer, (PyObject*)__pyx_v_rowptr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13704  }
13705  __pyx_pybuffernd_rowptr.diminfo[0].strides = __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_rowptr.diminfo[0].shape = __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.shape[0];
13706  {
13707  __Pyx_BufFmt_StackElem __pyx_stack[1];
13708  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_colind.rcbuffer->pybuffer, (PyObject*)__pyx_v_colind, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13709  }
13710  __pyx_pybuffernd_colind.diminfo[0].strides = __pyx_pybuffernd_colind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_colind.diminfo[0].shape = __pyx_pybuffernd_colind.rcbuffer->pybuffer.shape[0];
13711  {
13712  __Pyx_BufFmt_StackElem __pyx_stack[1];
13713  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementNeighborsArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13714  }
13715  __pyx_pybuffernd_elementNeighborsArray.diminfo[0].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[0].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].strides = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementNeighborsArray.diminfo[1].shape = __pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer.shape[1];
13716  {
13717  __Pyx_BufFmt_StackElem __pyx_stack[1];
13718  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementBarycentersArray, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13719  }
13720  __pyx_pybuffernd_elementBarycentersArray.diminfo[0].strides = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementBarycentersArray.diminfo[0].shape = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementBarycentersArray.diminfo[1].strides = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementBarycentersArray.diminfo[1].shape = __pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer.shape[1];
13721  {
13722  __Pyx_BufFmt_StackElem __pyx_stack[1];
13723  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_u, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13724  }
13725  __pyx_pybuffernd_q_u.diminfo[0].strides = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_u.diminfo[0].shape = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_u.diminfo[1].strides = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_u.diminfo[1].shape = __pyx_pybuffernd_q_u.rcbuffer->pybuffer.shape[1];
13726  {
13727  __Pyx_BufFmt_StackElem __pyx_stack[1];
13728  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_grad_u, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13729  }
13730  __pyx_pybuffernd_q_grad_u.diminfo[0].strides = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_grad_u.diminfo[0].shape = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_grad_u.diminfo[1].strides = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_grad_u.diminfo[1].shape = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_grad_u.diminfo[2].strides = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_grad_u.diminfo[2].shape = __pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer.shape[2];
13731  {
13732  __Pyx_BufFmt_StackElem __pyx_stack[1];
13733  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_grad_w, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13734  }
13735  __pyx_pybuffernd_q_grad_w.diminfo[0].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_grad_w.diminfo[0].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_grad_w.diminfo[1].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_grad_w.diminfo[1].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_grad_w.diminfo[2].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_grad_w.diminfo[2].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_q_grad_w.diminfo[3].strides = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_q_grad_w.diminfo[3].shape = __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.shape[3];
13736  {
13737  __Pyx_BufFmt_StackElem __pyx_stack[1];
13738  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_grad_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13739  }
13740  __pyx_pybuffernd_q_grad_v.diminfo[0].strides = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_grad_v.diminfo[0].shape = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_grad_v.diminfo[1].strides = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_grad_v.diminfo[1].shape = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_grad_v.diminfo[2].strides = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_grad_v.diminfo[2].shape = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_q_grad_v.diminfo[3].strides = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_q_grad_v.diminfo[3].shape = __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.shape[3];
13741  {
13742  __Pyx_BufFmt_StackElem __pyx_stack[1];
13743  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_detJ.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_detJ, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13744  }
13745  __pyx_pybuffernd_q_detJ.diminfo[0].strides = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_detJ.diminfo[0].shape = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_detJ.diminfo[1].strides = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_detJ.diminfo[1].shape = __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.shape[1];
13746  {
13747  __Pyx_BufFmt_StackElem __pyx_stack[1];
13748  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_m.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_m, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13749  }
13750  __pyx_pybuffernd_q_m.diminfo[0].strides = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_m.diminfo[0].shape = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_m.diminfo[1].strides = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_m.diminfo[1].shape = __pyx_pybuffernd_q_m.rcbuffer->pybuffer.shape[1];
13751  {
13752  __Pyx_BufFmt_StackElem __pyx_stack[1];
13753  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_dm.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_dm, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13754  }
13755  __pyx_pybuffernd_q_dm.diminfo[0].strides = __pyx_pybuffernd_q_dm.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_dm.diminfo[0].shape = __pyx_pybuffernd_q_dm.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_dm.diminfo[1].strides = __pyx_pybuffernd_q_dm.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_dm.diminfo[1].shape = __pyx_pybuffernd_q_dm.rcbuffer->pybuffer.shape[1];
13756  {
13757  __Pyx_BufFmt_StackElem __pyx_stack[1];
13758  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_mt.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_mt, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13759  }
13760  __pyx_pybuffernd_q_mt.diminfo[0].strides = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_mt.diminfo[0].shape = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_mt.diminfo[1].strides = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_mt.diminfo[1].shape = __pyx_pybuffernd_q_mt.rcbuffer->pybuffer.shape[1];
13761  {
13762  __Pyx_BufFmt_StackElem __pyx_stack[1];
13763  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_dmt.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_dmt, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13764  }
13765  __pyx_pybuffernd_q_dmt.diminfo[0].strides = __pyx_pybuffernd_q_dmt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_dmt.diminfo[0].shape = __pyx_pybuffernd_q_dmt.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_dmt.diminfo[1].strides = __pyx_pybuffernd_q_dmt.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_dmt.diminfo[1].shape = __pyx_pybuffernd_q_dmt.rcbuffer->pybuffer.shape[1];
13766  {
13767  __Pyx_BufFmt_StackElem __pyx_stack[1];
13768  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_r, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13769  }
13770  __pyx_pybuffernd_q_r.diminfo[0].strides = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_r.diminfo[0].shape = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_r.diminfo[1].strides = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_r.diminfo[1].shape = __pyx_pybuffernd_q_r.rcbuffer->pybuffer.shape[1];
13771  {
13772  __Pyx_BufFmt_StackElem __pyx_stack[1];
13773  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_kr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13774  }
13775  __pyx_pybuffernd_q_kr.diminfo[0].strides = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_kr.diminfo[0].shape = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_kr.diminfo[1].strides = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_kr.diminfo[1].shape = __pyx_pybuffernd_q_kr.rcbuffer->pybuffer.shape[1];
13776  {
13777  __Pyx_BufFmt_StackElem __pyx_stack[1];
13778  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_dkr.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_dkr, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13779  }
13780  __pyx_pybuffernd_q_dkr.diminfo[0].strides = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_dkr.diminfo[0].shape = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_dkr.diminfo[1].strides = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_dkr.diminfo[1].shape = __pyx_pybuffernd_q_dkr.rcbuffer->pybuffer.shape[1];
13781  {
13782  __Pyx_BufFmt_StackElem __pyx_stack[1];
13783  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_kr_up, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13784  }
13785  __pyx_pybuffernd_q_kr_up.diminfo[0].strides = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_kr_up.diminfo[0].shape = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_kr_up.diminfo[1].strides = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_kr_up.diminfo[1].shape = __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.shape[1];
13786  {
13787  __Pyx_BufFmt_StackElem __pyx_stack[1];
13788  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_flin, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13789  }
13790  __pyx_pybuffernd_q_flin.diminfo[0].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_flin.diminfo[0].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_flin.diminfo[1].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_flin.diminfo[1].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_flin.diminfo[2].strides = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_flin.diminfo[2].shape = __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.shape[2];
13791  {
13792  __Pyx_BufFmt_StackElem __pyx_stack[1];
13793  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer, (PyObject*)__pyx_v_q_alin, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13794  }
13795  __pyx_pybuffernd_q_alin.diminfo[0].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q_alin.diminfo[0].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_q_alin.diminfo[1].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_q_alin.diminfo[1].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_q_alin.diminfo[2].strides = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_q_alin.diminfo[2].shape = __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.shape[2];
13796  {
13797  __Pyx_BufFmt_StackElem __pyx_stack[1];
13798  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer, (PyObject*)__pyx_v_elementJacobian, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 574, __pyx_L1_error)
13799  }
13800  __pyx_pybuffernd_elementJacobian.diminfo[0].strides = __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_elementJacobian.diminfo[0].shape = __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_elementJacobian.diminfo[1].strides = __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_elementJacobian.diminfo[1].shape = __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_elementJacobian.diminfo[2].strides = __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_elementJacobian.diminfo[2].shape = __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.shape[2];
13801 
13802  /* "subsurfaceTransportFunctions.pyx":620
13803  *
13804  * """
13805  * cdef int upwindFlag = 1 # <<<<<<<<<<<<<<
13806  * cdef int picard = 1
13807  * #check some sizes
13808  */
13809  __pyx_v_upwindFlag = 1;
13810 
13811  /* "subsurfaceTransportFunctions.pyx":621
13812  * """
13813  * cdef int upwindFlag = 1
13814  * cdef int picard = 1 # <<<<<<<<<<<<<<
13815  * #check some sizes
13816  * for q in [q_u,q_m,q_mt,q_r,q_kr]:
13817  */
13818  __pyx_v_picard = 1;
13819 
13820  /* "subsurfaceTransportFunctions.pyx":623
13821  * cdef int picard = 1
13822  * #check some sizes
13823  * for q in [q_u,q_m,q_mt,q_r,q_kr]: # <<<<<<<<<<<<<<
13824  * assert q.shape[1] == nSpace+1
13825  * assert nDOF_test_element == nSpace+1
13826  */
13827  __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 623, __pyx_L1_error)
13828  __Pyx_GOTREF(__pyx_t_1);
13829  __Pyx_INCREF(((PyObject *)__pyx_v_q_u));
13830  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_u));
13831  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_q_u));
13832  __Pyx_INCREF(((PyObject *)__pyx_v_q_m));
13833  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_m));
13834  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_q_m));
13835  __Pyx_INCREF(((PyObject *)__pyx_v_q_mt));
13836  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_mt));
13837  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_q_mt));
13838  __Pyx_INCREF(((PyObject *)__pyx_v_q_r));
13839  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_r));
13840  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_v_q_r));
13841  __Pyx_INCREF(((PyObject *)__pyx_v_q_kr));
13842  __Pyx_GIVEREF(((PyObject *)__pyx_v_q_kr));
13843  PyTuple_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_v_q_kr));
13844  __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
13845  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13846  for (;;) {
13847  if (__pyx_t_3 >= 5) break;
13848  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13849  __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 623, __pyx_L1_error)
13850  #else
13851  __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 623, __pyx_L1_error)
13852  __Pyx_GOTREF(__pyx_t_1);
13853  #endif
13854  __Pyx_XDECREF_SET(__pyx_v_q, __pyx_t_1);
13855  __pyx_t_1 = 0;
13856 
13857  /* "subsurfaceTransportFunctions.pyx":624
13858  * #check some sizes
13859  * for q in [q_u,q_m,q_mt,q_r,q_kr]:
13860  * assert q.shape[1] == nSpace+1 # <<<<<<<<<<<<<<
13861  * assert nDOF_test_element == nSpace+1
13862  * cdef int nnz = rowptr[nSpace]
13863  */
13864  #ifndef CYTHON_WITHOUT_ASSERTIONS
13865  if (unlikely(!Py_OptimizeFlag)) {
13866  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_q, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 624, __pyx_L1_error)
13867  __Pyx_GOTREF(__pyx_t_1);
13868  __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 624, __pyx_L1_error)
13869  __Pyx_GOTREF(__pyx_t_4);
13870  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13871  __pyx_t_1 = __Pyx_PyInt_From_long((__pyx_v_nSpace + 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 624, __pyx_L1_error)
13872  __Pyx_GOTREF(__pyx_t_1);
13873  __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 624, __pyx_L1_error)
13874  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13875  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13876  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 624, __pyx_L1_error)
13877  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13878  if (unlikely(!__pyx_t_6)) {
13879  PyErr_SetNone(PyExc_AssertionError);
13880  __PYX_ERR(0, 624, __pyx_L1_error)
13881  }
13882  }
13883  #endif
13884 
13885  /* "subsurfaceTransportFunctions.pyx":623
13886  * cdef int picard = 1
13887  * #check some sizes
13888  * for q in [q_u,q_m,q_mt,q_r,q_kr]: # <<<<<<<<<<<<<<
13889  * assert q.shape[1] == nSpace+1
13890  * assert nDOF_test_element == nSpace+1
13891  */
13892  }
13893  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13894 
13895  /* "subsurfaceTransportFunctions.pyx":625
13896  * for q in [q_u,q_m,q_mt,q_r,q_kr]:
13897  * assert q.shape[1] == nSpace+1
13898  * assert nDOF_test_element == nSpace+1 # <<<<<<<<<<<<<<
13899  * cdef int nnz = rowptr[nSpace]
13900  * #temporaries
13901  */
13902  #ifndef CYTHON_WITHOUT_ASSERTIONS
13903  if (unlikely(!Py_OptimizeFlag)) {
13904  if (unlikely(!((__pyx_v_nDOF_test_element == (__pyx_v_nSpace + 1)) != 0))) {
13905  PyErr_SetNone(PyExc_AssertionError);
13906  __PYX_ERR(0, 625, __pyx_L1_error)
13907  }
13908  }
13909  #endif
13910 
13911  /* "subsurfaceTransportFunctions.pyx":626
13912  * assert q.shape[1] == nSpace+1
13913  * assert nDOF_test_element == nSpace+1
13914  * cdef int nnz = rowptr[nSpace] # <<<<<<<<<<<<<<
13915  * #temporaries
13916  * cdef double u_eN,kr_eN,phi_eN,u_neig,kr_neig,phi_neig,dkr_up
13917  */
13918  __pyx_t_7 = __pyx_v_nSpace;
13919  __pyx_t_8 = -1;
13920  if (__pyx_t_7 < 0) {
13921  __pyx_t_7 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
13922  if (unlikely(__pyx_t_7 < 0)) __pyx_t_8 = 0;
13923  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_8 = 0;
13924  if (unlikely(__pyx_t_8 != -1)) {
13925  __Pyx_RaiseBufferIndexError(__pyx_t_8);
13926  __PYX_ERR(0, 626, __pyx_L1_error)
13927  }
13928  __pyx_v_nnz = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_rowptr.diminfo[0].strides));
13929 
13930  /* "subsurfaceTransportFunctions.pyx":630
13931  * cdef double u_eN,kr_eN,phi_eN,u_neig,kr_neig,phi_neig,dkr_up
13932  * cdef int eN,eN_neighbor,ii,I
13933  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_up= numpy.zeros(nnz,'d') # <<<<<<<<<<<<<<
13934  * cdef numpy.ndarray[DTYPE_t,ndim=1] f_up= numpy.zeros(nSpace,'d')
13935  * #for averaging/integration weights
13936  */
13937  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_numpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 630, __pyx_L1_error)
13938  __Pyx_GOTREF(__pyx_t_5);
13939  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 630, __pyx_L1_error)
13940  __Pyx_GOTREF(__pyx_t_1);
13941  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13942  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_nnz); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 630, __pyx_L1_error)
13943  __Pyx_GOTREF(__pyx_t_5);
13944  __pyx_t_4 = NULL;
13945  __pyx_t_8 = 0;
13946  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
13947  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
13948  if (likely(__pyx_t_4)) {
13949  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
13950  __Pyx_INCREF(__pyx_t_4);
13951  __Pyx_INCREF(function);
13952  __Pyx_DECREF_SET(__pyx_t_1, function);
13953  __pyx_t_8 = 1;
13954  }
13955  }
13956  #if CYTHON_FAST_PYCALL
13957  if (PyFunction_Check(__pyx_t_1)) {
13958  PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_n_s_d};
13959  __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 630, __pyx_L1_error)
13960  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
13961  __Pyx_GOTREF(__pyx_t_2);
13962  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13963  } else
13964  #endif
13965  #if CYTHON_FAST_PYCCALL
13966  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
13967  PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_n_s_d};
13968  __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 630, __pyx_L1_error)
13969  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
13970  __Pyx_GOTREF(__pyx_t_2);
13971  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13972  } else
13973  #endif
13974  {
13975  __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 630, __pyx_L1_error)
13976  __Pyx_GOTREF(__pyx_t_9);
13977  if (__pyx_t_4) {
13978  __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4); __pyx_t_4 = NULL;
13979  }
13980  __Pyx_GIVEREF(__pyx_t_5);
13981  PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_5);
13982  __Pyx_INCREF(__pyx_n_s_d);
13983  __Pyx_GIVEREF(__pyx_n_s_d);
13984  PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_n_s_d);
13985  __pyx_t_5 = 0;
13986  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 630, __pyx_L1_error)
13987  __Pyx_GOTREF(__pyx_t_2);
13988  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
13989  }
13990  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13991  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 630, __pyx_L1_error)
13992  __pyx_t_10 = ((PyArrayObject *)__pyx_t_2);
13993  {
13994  __Pyx_BufFmt_StackElem __pyx_stack[1];
13995  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_a_up.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
13996  __pyx_v_a_up = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_a_up.rcbuffer->pybuffer.buf = NULL;
13997  __PYX_ERR(0, 630, __pyx_L1_error)
13998  } else {__pyx_pybuffernd_a_up.diminfo[0].strides = __pyx_pybuffernd_a_up.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_a_up.diminfo[0].shape = __pyx_pybuffernd_a_up.rcbuffer->pybuffer.shape[0];
13999  }
14000  }
14001  __pyx_t_10 = 0;
14002  __pyx_v_a_up = ((PyArrayObject *)__pyx_t_2);
14003  __pyx_t_2 = 0;
14004 
14005  /* "subsurfaceTransportFunctions.pyx":631
14006  * cdef int eN,eN_neighbor,ii,I
14007  * cdef numpy.ndarray[DTYPE_t,ndim=1] a_up= numpy.zeros(nnz,'d')
14008  * cdef numpy.ndarray[DTYPE_t,ndim=1] f_up= numpy.zeros(nSpace,'d') # <<<<<<<<<<<<<<
14009  * #for averaging/integration weights
14010  * cdef double nAvgWeight = 1.0/(nSpace+1.)
14011  */
14012  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 631, __pyx_L1_error)
14013  __Pyx_GOTREF(__pyx_t_1);
14014  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 631, __pyx_L1_error)
14015  __Pyx_GOTREF(__pyx_t_9);
14016  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14017  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_nSpace); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 631, __pyx_L1_error)
14018  __Pyx_GOTREF(__pyx_t_1);
14019  __pyx_t_5 = NULL;
14020  __pyx_t_8 = 0;
14021  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
14022  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_9);
14023  if (likely(__pyx_t_5)) {
14024  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
14025  __Pyx_INCREF(__pyx_t_5);
14026  __Pyx_INCREF(function);
14027  __Pyx_DECREF_SET(__pyx_t_9, function);
14028  __pyx_t_8 = 1;
14029  }
14030  }
14031  #if CYTHON_FAST_PYCALL
14032  if (PyFunction_Check(__pyx_t_9)) {
14033  PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_n_s_d};
14034  __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 631, __pyx_L1_error)
14035  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
14036  __Pyx_GOTREF(__pyx_t_2);
14037  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14038  } else
14039  #endif
14040  #if CYTHON_FAST_PYCCALL
14041  if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
14042  PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_n_s_d};
14043  __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 631, __pyx_L1_error)
14044  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
14045  __Pyx_GOTREF(__pyx_t_2);
14046  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14047  } else
14048  #endif
14049  {
14050  __pyx_t_4 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 631, __pyx_L1_error)
14051  __Pyx_GOTREF(__pyx_t_4);
14052  if (__pyx_t_5) {
14053  __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL;
14054  }
14055  __Pyx_GIVEREF(__pyx_t_1);
14056  PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_8, __pyx_t_1);
14057  __Pyx_INCREF(__pyx_n_s_d);
14058  __Pyx_GIVEREF(__pyx_n_s_d);
14059  PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_8, __pyx_n_s_d);
14060  __pyx_t_1 = 0;
14061  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 631, __pyx_L1_error)
14062  __Pyx_GOTREF(__pyx_t_2);
14063  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14064  }
14065  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14066  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 631, __pyx_L1_error)
14067  __pyx_t_11 = ((PyArrayObject *)__pyx_t_2);
14068  {
14069  __Pyx_BufFmt_StackElem __pyx_stack[1];
14070  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_f_up.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
14071  __pyx_v_f_up = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_f_up.rcbuffer->pybuffer.buf = NULL;
14072  __PYX_ERR(0, 631, __pyx_L1_error)
14073  } else {__pyx_pybuffernd_f_up.diminfo[0].strides = __pyx_pybuffernd_f_up.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_f_up.diminfo[0].shape = __pyx_pybuffernd_f_up.rcbuffer->pybuffer.shape[0];
14074  }
14075  }
14076  __pyx_t_11 = 0;
14077  __pyx_v_f_up = ((PyArrayObject *)__pyx_t_2);
14078  __pyx_t_2 = 0;
14079 
14080  /* "subsurfaceTransportFunctions.pyx":633
14081  * cdef numpy.ndarray[DTYPE_t,ndim=1] f_up= numpy.zeros(nSpace,'d')
14082  * #for averaging/integration weights
14083  * cdef double nAvgWeight = 1.0/(nSpace+1.) # <<<<<<<<<<<<<<
14084  * cdef double weight=1.0,volFactor = 1.0
14085  * cdef int thisElementIsUpwind = 1
14086  */
14087  __pyx_t_12 = (__pyx_v_nSpace + 1.);
14088  if (unlikely(__pyx_t_12 == 0)) {
14089  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
14090  __PYX_ERR(0, 633, __pyx_L1_error)
14091  }
14092  __pyx_v_nAvgWeight = (1.0 / __pyx_t_12);
14093 
14094  /* "subsurfaceTransportFunctions.pyx":634
14095  * #for averaging/integration weights
14096  * cdef double nAvgWeight = 1.0/(nSpace+1.)
14097  * cdef double weight=1.0,volFactor = 1.0 # <<<<<<<<<<<<<<
14098  * cdef int thisElementIsUpwind = 1
14099  * if nSpace == 2:
14100  */
14101  __pyx_v_weight = 1.0;
14102  __pyx_v_volFactor = 1.0;
14103 
14104  /* "subsurfaceTransportFunctions.pyx":635
14105  * cdef double nAvgWeight = 1.0/(nSpace+1.)
14106  * cdef double weight=1.0,volFactor = 1.0
14107  * cdef int thisElementIsUpwind = 1 # <<<<<<<<<<<<<<
14108  * if nSpace == 2:
14109  * volFactor = 0.5
14110  */
14111  __pyx_v_thisElementIsUpwind = 1;
14112 
14113  /* "subsurfaceTransportFunctions.pyx":636
14114  * cdef double weight=1.0,volFactor = 1.0
14115  * cdef int thisElementIsUpwind = 1
14116  * if nSpace == 2: # <<<<<<<<<<<<<<
14117  * volFactor = 0.5
14118  * if nSpace == 3:
14119  */
14120  __pyx_t_6 = ((__pyx_v_nSpace == 2) != 0);
14121  if (__pyx_t_6) {
14122 
14123  /* "subsurfaceTransportFunctions.pyx":637
14124  * cdef int thisElementIsUpwind = 1
14125  * if nSpace == 2:
14126  * volFactor = 0.5 # <<<<<<<<<<<<<<
14127  * if nSpace == 3:
14128  * volFactor = 1.0/6.0
14129  */
14130  __pyx_v_volFactor = 0.5;
14131 
14132  /* "subsurfaceTransportFunctions.pyx":636
14133  * cdef double weight=1.0,volFactor = 1.0
14134  * cdef int thisElementIsUpwind = 1
14135  * if nSpace == 2: # <<<<<<<<<<<<<<
14136  * volFactor = 0.5
14137  * if nSpace == 3:
14138  */
14139  }
14140 
14141  /* "subsurfaceTransportFunctions.pyx":638
14142  * if nSpace == 2:
14143  * volFactor = 0.5
14144  * if nSpace == 3: # <<<<<<<<<<<<<<
14145  * volFactor = 1.0/6.0
14146  * #
14147  */
14148  __pyx_t_6 = ((__pyx_v_nSpace == 3) != 0);
14149  if (__pyx_t_6) {
14150 
14151  /* "subsurfaceTransportFunctions.pyx":639
14152  * volFactor = 0.5
14153  * if nSpace == 3:
14154  * volFactor = 1.0/6.0 # <<<<<<<<<<<<<<
14155  * #
14156  * for eN in range(nElements_global):
14157  */
14158  __pyx_v_volFactor = (1.0 / 6.0);
14159 
14160  /* "subsurfaceTransportFunctions.pyx":638
14161  * if nSpace == 2:
14162  * volFactor = 0.5
14163  * if nSpace == 3: # <<<<<<<<<<<<<<
14164  * volFactor = 1.0/6.0
14165  * #
14166  */
14167  }
14168 
14169  /* "subsurfaceTransportFunctions.pyx":641
14170  * volFactor = 1.0/6.0
14171  * #
14172  * for eN in range(nElements_global): # <<<<<<<<<<<<<<
14173  * volume = volFactor*fabs(q_detJ[eN,0]) #affine transformation
14174  * weight = nAvgWeight*volume
14175  */
14176  __pyx_t_8 = __pyx_v_nElements_global;
14177  __pyx_t_13 = __pyx_t_8;
14178  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
14179  __pyx_v_eN = __pyx_t_14;
14180 
14181  /* "subsurfaceTransportFunctions.pyx":642
14182  * #
14183  * for eN in range(nElements_global):
14184  * volume = volFactor*fabs(q_detJ[eN,0]) #affine transformation # <<<<<<<<<<<<<<
14185  * weight = nAvgWeight*volume
14186  *
14187  */
14188  __pyx_t_7 = __pyx_v_eN;
14189  __pyx_t_15 = 0;
14190  __pyx_t_16 = -1;
14191  if (__pyx_t_7 < 0) {
14192  __pyx_t_7 += __pyx_pybuffernd_q_detJ.diminfo[0].shape;
14193  if (unlikely(__pyx_t_7 < 0)) __pyx_t_16 = 0;
14194  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_q_detJ.diminfo[0].shape)) __pyx_t_16 = 0;
14195  if (__pyx_t_15 < 0) {
14196  __pyx_t_15 += __pyx_pybuffernd_q_detJ.diminfo[1].shape;
14197  if (unlikely(__pyx_t_15 < 0)) __pyx_t_16 = 1;
14198  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_detJ.diminfo[1].shape)) __pyx_t_16 = 1;
14199  if (unlikely(__pyx_t_16 != -1)) {
14200  __Pyx_RaiseBufferIndexError(__pyx_t_16);
14201  __PYX_ERR(0, 642, __pyx_L1_error)
14202  }
14203  __pyx_v_volume = (__pyx_v_volFactor * fabs((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_detJ.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_q_detJ.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_q_detJ.diminfo[1].strides))));
14204 
14205  /* "subsurfaceTransportFunctions.pyx":643
14206  * for eN in range(nElements_global):
14207  * volume = volFactor*fabs(q_detJ[eN,0]) #affine transformation
14208  * weight = nAvgWeight*volume # <<<<<<<<<<<<<<
14209  *
14210  *
14211  */
14212  __pyx_v_weight = (__pyx_v_nAvgWeight * __pyx_v_volume);
14213 
14214  /* "subsurfaceTransportFunctions.pyx":646
14215  *
14216  *
14217  * for i in range(nDOF_test_element): # <<<<<<<<<<<<<<
14218  * #nodal quadrature so diagonal
14219  * ##mass
14220  */
14221  __pyx_t_16 = __pyx_v_nDOF_test_element;
14222  __pyx_t_17 = __pyx_t_16;
14223  for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
14224  __pyx_v_i = __pyx_t_18;
14225 
14226  /* "subsurfaceTransportFunctions.pyx":650
14227  * ##mass
14228  * #elementResidual[eN,i] += weight*q_m[eN,i]
14229  * elementJacobian[eN,i,i] += weight*q_dmt[eN,i] # <<<<<<<<<<<<<<
14230  *
14231  * #have to actually compute loop over other nodes for stiffness terms
14232  */
14233  __pyx_t_15 = __pyx_v_eN;
14234  __pyx_t_7 = __pyx_v_i;
14235  __pyx_t_19 = -1;
14236  if (__pyx_t_15 < 0) {
14237  __pyx_t_15 += __pyx_pybuffernd_q_dmt.diminfo[0].shape;
14238  if (unlikely(__pyx_t_15 < 0)) __pyx_t_19 = 0;
14239  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_dmt.diminfo[0].shape)) __pyx_t_19 = 0;
14240  if (__pyx_t_7 < 0) {
14241  __pyx_t_7 += __pyx_pybuffernd_q_dmt.diminfo[1].shape;
14242  if (unlikely(__pyx_t_7 < 0)) __pyx_t_19 = 1;
14243  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_q_dmt.diminfo[1].shape)) __pyx_t_19 = 1;
14244  if (unlikely(__pyx_t_19 != -1)) {
14245  __Pyx_RaiseBufferIndexError(__pyx_t_19);
14246  __PYX_ERR(0, 650, __pyx_L1_error)
14247  }
14248  __pyx_t_20 = __pyx_v_eN;
14249  __pyx_t_21 = __pyx_v_i;
14250  __pyx_t_22 = __pyx_v_i;
14251  __pyx_t_19 = -1;
14252  if (__pyx_t_20 < 0) {
14253  __pyx_t_20 += __pyx_pybuffernd_elementJacobian.diminfo[0].shape;
14254  if (unlikely(__pyx_t_20 < 0)) __pyx_t_19 = 0;
14255  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_elementJacobian.diminfo[0].shape)) __pyx_t_19 = 0;
14256  if (__pyx_t_21 < 0) {
14257  __pyx_t_21 += __pyx_pybuffernd_elementJacobian.diminfo[1].shape;
14258  if (unlikely(__pyx_t_21 < 0)) __pyx_t_19 = 1;
14259  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_elementJacobian.diminfo[1].shape)) __pyx_t_19 = 1;
14260  if (__pyx_t_22 < 0) {
14261  __pyx_t_22 += __pyx_pybuffernd_elementJacobian.diminfo[2].shape;
14262  if (unlikely(__pyx_t_22 < 0)) __pyx_t_19 = 2;
14263  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_elementJacobian.diminfo[2].shape)) __pyx_t_19 = 2;
14264  if (unlikely(__pyx_t_19 != -1)) {
14265  __Pyx_RaiseBufferIndexError(__pyx_t_19);
14266  __PYX_ERR(0, 650, __pyx_L1_error)
14267  }
14268  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_elementJacobian.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_elementJacobian.diminfo[1].strides, __pyx_t_22, __pyx_pybuffernd_elementJacobian.diminfo[2].strides) += (__pyx_v_weight * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_dmt.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_q_dmt.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_q_dmt.diminfo[1].strides)));
14269 
14270  /* "subsurfaceTransportFunctions.pyx":653
14271  *
14272  * #have to actually compute loop over other nodes for stiffness terms
14273  * for ebN in range(nElementBoundaries_element): #same as nDOF_trial , nElementBoundaries_ # <<<<<<<<<<<<<<
14274  * #assumes linear parts of f and a and upwind k_r have already been evaluated correctly for interface
14275  * for ii in range(nnz):
14276  */
14277  __pyx_t_19 = __pyx_v_nElementBoundaries_element;
14278  __pyx_t_23 = __pyx_t_19;
14279  for (__pyx_t_24 = 0; __pyx_t_24 < __pyx_t_23; __pyx_t_24+=1) {
14280  __pyx_v_ebN = __pyx_t_24;
14281 
14282  /* "subsurfaceTransportFunctions.pyx":655
14283  * for ebN in range(nElementBoundaries_element): #same as nDOF_trial , nElementBoundaries_
14284  * #assumes linear parts of f and a and upwind k_r have already been evaluated correctly for interface
14285  * for ii in range(nnz): # <<<<<<<<<<<<<<
14286  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN]
14287  * for I in range(nSpace):
14288  */
14289  __pyx_t_25 = __pyx_v_nnz;
14290  __pyx_t_26 = __pyx_t_25;
14291  for (__pyx_t_27 = 0; __pyx_t_27 < __pyx_t_26; __pyx_t_27+=1) {
14292  __pyx_v_ii = __pyx_t_27;
14293 
14294  /* "subsurfaceTransportFunctions.pyx":656
14295  * #assumes linear parts of f and a and upwind k_r have already been evaluated correctly for interface
14296  * for ii in range(nnz):
14297  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN] # <<<<<<<<<<<<<<
14298  * for I in range(nSpace):
14299  * f_up[I] = q_flin[eN,ebN,I]*q_kr_up[eN,ebN]
14300  */
14301  __pyx_t_7 = __pyx_v_eN;
14302  __pyx_t_15 = __pyx_v_ebN;
14303  __pyx_t_22 = __pyx_v_ii;
14304  __pyx_t_28 = -1;
14305  if (__pyx_t_7 < 0) {
14306  __pyx_t_7 += __pyx_pybuffernd_q_alin.diminfo[0].shape;
14307  if (unlikely(__pyx_t_7 < 0)) __pyx_t_28 = 0;
14308  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_q_alin.diminfo[0].shape)) __pyx_t_28 = 0;
14309  if (__pyx_t_15 < 0) {
14310  __pyx_t_15 += __pyx_pybuffernd_q_alin.diminfo[1].shape;
14311  if (unlikely(__pyx_t_15 < 0)) __pyx_t_28 = 1;
14312  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_alin.diminfo[1].shape)) __pyx_t_28 = 1;
14313  if (__pyx_t_22 < 0) {
14314  __pyx_t_22 += __pyx_pybuffernd_q_alin.diminfo[2].shape;
14315  if (unlikely(__pyx_t_22 < 0)) __pyx_t_28 = 2;
14316  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_q_alin.diminfo[2].shape)) __pyx_t_28 = 2;
14317  if (unlikely(__pyx_t_28 != -1)) {
14318  __Pyx_RaiseBufferIndexError(__pyx_t_28);
14319  __PYX_ERR(0, 656, __pyx_L1_error)
14320  }
14321  __pyx_t_21 = __pyx_v_eN;
14322  __pyx_t_20 = __pyx_v_ebN;
14323  __pyx_t_28 = -1;
14324  if (__pyx_t_21 < 0) {
14325  __pyx_t_21 += __pyx_pybuffernd_q_kr_up.diminfo[0].shape;
14326  if (unlikely(__pyx_t_21 < 0)) __pyx_t_28 = 0;
14327  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_q_kr_up.diminfo[0].shape)) __pyx_t_28 = 0;
14328  if (__pyx_t_20 < 0) {
14329  __pyx_t_20 += __pyx_pybuffernd_q_kr_up.diminfo[1].shape;
14330  if (unlikely(__pyx_t_20 < 0)) __pyx_t_28 = 1;
14331  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_q_kr_up.diminfo[1].shape)) __pyx_t_28 = 1;
14332  if (unlikely(__pyx_t_28 != -1)) {
14333  __Pyx_RaiseBufferIndexError(__pyx_t_28);
14334  __PYX_ERR(0, 656, __pyx_L1_error)
14335  }
14336  __pyx_t_29 = __pyx_v_ii;
14337  __pyx_t_28 = -1;
14338  if (__pyx_t_29 < 0) {
14339  __pyx_t_29 += __pyx_pybuffernd_a_up.diminfo[0].shape;
14340  if (unlikely(__pyx_t_29 < 0)) __pyx_t_28 = 0;
14341  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_a_up.diminfo[0].shape)) __pyx_t_28 = 0;
14342  if (unlikely(__pyx_t_28 != -1)) {
14343  __Pyx_RaiseBufferIndexError(__pyx_t_28);
14344  __PYX_ERR(0, 656, __pyx_L1_error)
14345  }
14346  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_up.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_a_up.diminfo[0].strides) = ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_alin.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_q_alin.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_q_alin.diminfo[1].strides, __pyx_t_22, __pyx_pybuffernd_q_alin.diminfo[2].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_q_kr_up.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_q_kr_up.diminfo[1].strides)));
14347  }
14348 
14349  /* "subsurfaceTransportFunctions.pyx":657
14350  * for ii in range(nnz):
14351  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN]
14352  * for I in range(nSpace): # <<<<<<<<<<<<<<
14353  * f_up[I] = q_flin[eN,ebN,I]*q_kr_up[eN,ebN]
14354  * #
14355  */
14356  __pyx_t_25 = __pyx_v_nSpace;
14357  __pyx_t_26 = __pyx_t_25;
14358  for (__pyx_t_27 = 0; __pyx_t_27 < __pyx_t_26; __pyx_t_27+=1) {
14359  __pyx_v_I = __pyx_t_27;
14360 
14361  /* "subsurfaceTransportFunctions.pyx":658
14362  * a_up[ii] = q_alin[eN,ebN,ii]*q_kr_up[eN,ebN]
14363  * for I in range(nSpace):
14364  * f_up[I] = q_flin[eN,ebN,I]*q_kr_up[eN,ebN] # <<<<<<<<<<<<<<
14365  * #
14366  *
14367  */
14368  __pyx_t_20 = __pyx_v_eN;
14369  __pyx_t_21 = __pyx_v_ebN;
14370  __pyx_t_22 = __pyx_v_I;
14371  __pyx_t_28 = -1;
14372  if (__pyx_t_20 < 0) {
14373  __pyx_t_20 += __pyx_pybuffernd_q_flin.diminfo[0].shape;
14374  if (unlikely(__pyx_t_20 < 0)) __pyx_t_28 = 0;
14375  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_q_flin.diminfo[0].shape)) __pyx_t_28 = 0;
14376  if (__pyx_t_21 < 0) {
14377  __pyx_t_21 += __pyx_pybuffernd_q_flin.diminfo[1].shape;
14378  if (unlikely(__pyx_t_21 < 0)) __pyx_t_28 = 1;
14379  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_q_flin.diminfo[1].shape)) __pyx_t_28 = 1;
14380  if (__pyx_t_22 < 0) {
14381  __pyx_t_22 += __pyx_pybuffernd_q_flin.diminfo[2].shape;
14382  if (unlikely(__pyx_t_22 < 0)) __pyx_t_28 = 2;
14383  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_q_flin.diminfo[2].shape)) __pyx_t_28 = 2;
14384  if (unlikely(__pyx_t_28 != -1)) {
14385  __Pyx_RaiseBufferIndexError(__pyx_t_28);
14386  __PYX_ERR(0, 658, __pyx_L1_error)
14387  }
14388  __pyx_t_15 = __pyx_v_eN;
14389  __pyx_t_7 = __pyx_v_ebN;
14390  __pyx_t_28 = -1;
14391  if (__pyx_t_15 < 0) {
14392  __pyx_t_15 += __pyx_pybuffernd_q_kr_up.diminfo[0].shape;
14393  if (unlikely(__pyx_t_15 < 0)) __pyx_t_28 = 0;
14394  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_q_kr_up.diminfo[0].shape)) __pyx_t_28 = 0;
14395  if (__pyx_t_7 < 0) {
14396  __pyx_t_7 += __pyx_pybuffernd_q_kr_up.diminfo[1].shape;
14397  if (unlikely(__pyx_t_7 < 0)) __pyx_t_28 = 1;
14398  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_q_kr_up.diminfo[1].shape)) __pyx_t_28 = 1;
14399  if (unlikely(__pyx_t_28 != -1)) {
14400  __Pyx_RaiseBufferIndexError(__pyx_t_28);
14401  __PYX_ERR(0, 658, __pyx_L1_error)
14402  }
14403  __pyx_t_29 = __pyx_v_I;
14404  __pyx_t_28 = -1;
14405  if (__pyx_t_29 < 0) {
14406  __pyx_t_29 += __pyx_pybuffernd_f_up.diminfo[0].shape;
14407  if (unlikely(__pyx_t_29 < 0)) __pyx_t_28 = 0;
14408  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_f_up.diminfo[0].shape)) __pyx_t_28 = 0;
14409  if (unlikely(__pyx_t_28 != -1)) {
14410  __Pyx_RaiseBufferIndexError(__pyx_t_28);
14411  __PYX_ERR(0, 658, __pyx_L1_error)
14412  }
14413  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_f_up.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_f_up.diminfo[0].strides) = ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_flin.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_q_flin.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_q_flin.diminfo[1].strides, __pyx_t_22, __pyx_pybuffernd_q_flin.diminfo[2].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_q_kr_up.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_q_kr_up.diminfo[1].strides)));
14414  }
14415 
14416  /* "subsurfaceTransportFunctions.pyx":662
14417  *
14418  * #Picard part first
14419  * for j in range(nDOF_trial_element): # <<<<<<<<<<<<<<
14420  * for I in range(nSpace):
14421  * for ii in range(rowptr[I],rowptr[I+1]):
14422  */
14423  __pyx_t_25 = __pyx_v_nDOF_trial_element;
14424  __pyx_t_26 = __pyx_t_25;
14425  for (__pyx_t_27 = 0; __pyx_t_27 < __pyx_t_26; __pyx_t_27+=1) {
14426  __pyx_v_j = __pyx_t_27;
14427 
14428  /* "subsurfaceTransportFunctions.pyx":663
14429  * #Picard part first
14430  * for j in range(nDOF_trial_element):
14431  * for I in range(nSpace): # <<<<<<<<<<<<<<
14432  * for ii in range(rowptr[I],rowptr[I+1]):
14433  * elementJacobian[eN,i,j] += weight*a_up[ii]*q_grad_v[eN,ebN,j,colind[ii]]*q_grad_w[eN,ebN,i,I]
14434  */
14435  __pyx_t_28 = __pyx_v_nSpace;
14436  __pyx_t_30 = __pyx_t_28;
14437  for (__pyx_t_31 = 0; __pyx_t_31 < __pyx_t_30; __pyx_t_31+=1) {
14438  __pyx_v_I = __pyx_t_31;
14439 
14440  /* "subsurfaceTransportFunctions.pyx":664
14441  * for j in range(nDOF_trial_element):
14442  * for I in range(nSpace):
14443  * for ii in range(rowptr[I],rowptr[I+1]): # <<<<<<<<<<<<<<
14444  * elementJacobian[eN,i,j] += weight*a_up[ii]*q_grad_v[eN,ebN,j,colind[ii]]*q_grad_w[eN,ebN,i,I]
14445  * #j picard
14446  */
14447  __pyx_t_7 = (__pyx_v_I + 1);
14448  __pyx_t_32 = -1;
14449  if (__pyx_t_7 < 0) {
14450  __pyx_t_7 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
14451  if (unlikely(__pyx_t_7 < 0)) __pyx_t_32 = 0;
14452  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_32 = 0;
14453  if (unlikely(__pyx_t_32 != -1)) {
14454  __Pyx_RaiseBufferIndexError(__pyx_t_32);
14455  __PYX_ERR(0, 664, __pyx_L1_error)
14456  }
14457  __pyx_t_33 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_rowptr.diminfo[0].strides));
14458  __pyx_t_7 = __pyx_v_I;
14459  __pyx_t_32 = -1;
14460  if (__pyx_t_7 < 0) {
14461  __pyx_t_7 += __pyx_pybuffernd_rowptr.diminfo[0].shape;
14462  if (unlikely(__pyx_t_7 < 0)) __pyx_t_32 = 0;
14463  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_rowptr.diminfo[0].shape)) __pyx_t_32 = 0;
14464  if (unlikely(__pyx_t_32 != -1)) {
14465  __Pyx_RaiseBufferIndexError(__pyx_t_32);
14466  __PYX_ERR(0, 664, __pyx_L1_error)
14467  }
14468  __pyx_t_34 = __pyx_t_33;
14469  for (__pyx_t_32 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_rowptr.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_rowptr.diminfo[0].strides)); __pyx_t_32 < __pyx_t_34; __pyx_t_32+=1) {
14470  __pyx_v_ii = __pyx_t_32;
14471 
14472  /* "subsurfaceTransportFunctions.pyx":665
14473  * for I in range(nSpace):
14474  * for ii in range(rowptr[I],rowptr[I+1]):
14475  * elementJacobian[eN,i,j] += weight*a_up[ii]*q_grad_v[eN,ebN,j,colind[ii]]*q_grad_w[eN,ebN,i,I] # <<<<<<<<<<<<<<
14476  * #j picard
14477  * #i
14478  */
14479  __pyx_t_15 = __pyx_v_ii;
14480  __pyx_t_35 = -1;
14481  if (__pyx_t_15 < 0) {
14482  __pyx_t_15 += __pyx_pybuffernd_a_up.diminfo[0].shape;
14483  if (unlikely(__pyx_t_15 < 0)) __pyx_t_35 = 0;
14484  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_a_up.diminfo[0].shape)) __pyx_t_35 = 0;
14485  if (unlikely(__pyx_t_35 != -1)) {
14486  __Pyx_RaiseBufferIndexError(__pyx_t_35);
14487  __PYX_ERR(0, 665, __pyx_L1_error)
14488  }
14489  __pyx_t_22 = __pyx_v_ii;
14490  __pyx_t_35 = -1;
14491  if (__pyx_t_22 < 0) {
14492  __pyx_t_22 += __pyx_pybuffernd_colind.diminfo[0].shape;
14493  if (unlikely(__pyx_t_22 < 0)) __pyx_t_35 = 0;
14494  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_colind.diminfo[0].shape)) __pyx_t_35 = 0;
14495  if (unlikely(__pyx_t_35 != -1)) {
14496  __Pyx_RaiseBufferIndexError(__pyx_t_35);
14497  __PYX_ERR(0, 665, __pyx_L1_error)
14498  }
14499  __pyx_t_21 = __pyx_v_eN;
14500  __pyx_t_20 = __pyx_v_ebN;
14501  __pyx_t_29 = __pyx_v_j;
14502  __pyx_t_36 = (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_colind.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_colind.diminfo[0].strides));
14503  __pyx_t_35 = -1;
14504  if (__pyx_t_21 < 0) {
14505  __pyx_t_21 += __pyx_pybuffernd_q_grad_v.diminfo[0].shape;
14506  if (unlikely(__pyx_t_21 < 0)) __pyx_t_35 = 0;
14507  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_q_grad_v.diminfo[0].shape)) __pyx_t_35 = 0;
14508  if (__pyx_t_20 < 0) {
14509  __pyx_t_20 += __pyx_pybuffernd_q_grad_v.diminfo[1].shape;
14510  if (unlikely(__pyx_t_20 < 0)) __pyx_t_35 = 1;
14511  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_q_grad_v.diminfo[1].shape)) __pyx_t_35 = 1;
14512  if (__pyx_t_29 < 0) {
14513  __pyx_t_29 += __pyx_pybuffernd_q_grad_v.diminfo[2].shape;
14514  if (unlikely(__pyx_t_29 < 0)) __pyx_t_35 = 2;
14515  } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_q_grad_v.diminfo[2].shape)) __pyx_t_35 = 2;
14516  if (__pyx_t_36 < 0) {
14517  __pyx_t_36 += __pyx_pybuffernd_q_grad_v.diminfo[3].shape;
14518  if (unlikely(__pyx_t_36 < 0)) __pyx_t_35 = 3;
14519  } else if (unlikely(__pyx_t_36 >= __pyx_pybuffernd_q_grad_v.diminfo[3].shape)) __pyx_t_35 = 3;
14520  if (unlikely(__pyx_t_35 != -1)) {
14521  __Pyx_RaiseBufferIndexError(__pyx_t_35);
14522  __PYX_ERR(0, 665, __pyx_L1_error)
14523  }
14524  __pyx_t_37 = __pyx_v_eN;
14525  __pyx_t_38 = __pyx_v_ebN;
14526  __pyx_t_39 = __pyx_v_i;
14527  __pyx_t_40 = __pyx_v_I;
14528  __pyx_t_35 = -1;
14529  if (__pyx_t_37 < 0) {
14530  __pyx_t_37 += __pyx_pybuffernd_q_grad_w.diminfo[0].shape;
14531  if (unlikely(__pyx_t_37 < 0)) __pyx_t_35 = 0;
14532  } else if (unlikely(__pyx_t_37 >= __pyx_pybuffernd_q_grad_w.diminfo[0].shape)) __pyx_t_35 = 0;
14533  if (__pyx_t_38 < 0) {
14534  __pyx_t_38 += __pyx_pybuffernd_q_grad_w.diminfo[1].shape;
14535  if (unlikely(__pyx_t_38 < 0)) __pyx_t_35 = 1;
14536  } else if (unlikely(__pyx_t_38 >= __pyx_pybuffernd_q_grad_w.diminfo[1].shape)) __pyx_t_35 = 1;
14537  if (__pyx_t_39 < 0) {
14538  __pyx_t_39 += __pyx_pybuffernd_q_grad_w.diminfo[2].shape;
14539  if (unlikely(__pyx_t_39 < 0)) __pyx_t_35 = 2;
14540  } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_q_grad_w.diminfo[2].shape)) __pyx_t_35 = 2;
14541  if (__pyx_t_40 < 0) {
14542  __pyx_t_40 += __pyx_pybuffernd_q_grad_w.diminfo[3].shape;
14543  if (unlikely(__pyx_t_40 < 0)) __pyx_t_35 = 3;
14544  } else if (unlikely(__pyx_t_40 >= __pyx_pybuffernd_q_grad_w.diminfo[3].shape)) __pyx_t_35 = 3;
14545  if (unlikely(__pyx_t_35 != -1)) {
14546  __Pyx_RaiseBufferIndexError(__pyx_t_35);
14547  __PYX_ERR(0, 665, __pyx_L1_error)
14548  }
14549  __pyx_t_41 = __pyx_v_eN;
14550  __pyx_t_42 = __pyx_v_i;
14551  __pyx_t_43 = __pyx_v_j;
14552  __pyx_t_35 = -1;
14553  if (__pyx_t_41 < 0) {
14554  __pyx_t_41 += __pyx_pybuffernd_elementJacobian.diminfo[0].shape;
14555  if (unlikely(__pyx_t_41 < 0)) __pyx_t_35 = 0;
14556  } else if (unlikely(__pyx_t_41 >= __pyx_pybuffernd_elementJacobian.diminfo[0].shape)) __pyx_t_35 = 0;
14557  if (__pyx_t_42 < 0) {
14558  __pyx_t_42 += __pyx_pybuffernd_elementJacobian.diminfo[1].shape;
14559  if (unlikely(__pyx_t_42 < 0)) __pyx_t_35 = 1;
14560  } else if (unlikely(__pyx_t_42 >= __pyx_pybuffernd_elementJacobian.diminfo[1].shape)) __pyx_t_35 = 1;
14561  if (__pyx_t_43 < 0) {
14562  __pyx_t_43 += __pyx_pybuffernd_elementJacobian.diminfo[2].shape;
14563  if (unlikely(__pyx_t_43 < 0)) __pyx_t_35 = 2;
14564  } else if (unlikely(__pyx_t_43 >= __pyx_pybuffernd_elementJacobian.diminfo[2].shape)) __pyx_t_35 = 2;
14565  if (unlikely(__pyx_t_35 != -1)) {
14566  __Pyx_RaiseBufferIndexError(__pyx_t_35);
14567  __PYX_ERR(0, 665, __pyx_L1_error)
14568  }
14569  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_elementJacobian.diminfo[0].strides, __pyx_t_42, __pyx_pybuffernd_elementJacobian.diminfo[1].strides, __pyx_t_43, __pyx_pybuffernd_elementJacobian.diminfo[2].strides) += (((__pyx_v_weight * (*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_a_up.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_a_up.diminfo[0].strides))) * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_q_grad_v.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_q_grad_v.diminfo[1].strides, __pyx_t_29, __pyx_pybuffernd_q_grad_v.diminfo[2].strides, __pyx_t_36, __pyx_pybuffernd_q_grad_v.diminfo[3].strides))) * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_q_grad_w.diminfo[0].strides, __pyx_t_38, __pyx_pybuffernd_q_grad_w.diminfo[1].strides, __pyx_t_39, __pyx_pybuffernd_q_grad_w.diminfo[2].strides, __pyx_t_40, __pyx_pybuffernd_q_grad_w.diminfo[3].strides)));
14570  }
14571  }
14572  }
14573  }
14574  }
14575  }
14576 
14577  /* "subsurfaceTransportFunctions.pyx":574
14578  * #i
14579  * #eN
14580  * def RE_NCP1_getElementJacobian(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
14581  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
14582  * numpy.ndarray[ITYPE_t,ndim=1] colind,
14583  */
14584 
14585  /* function exit code */
14586  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
14587  goto __pyx_L0;
14588  __pyx_L1_error:;
14589  __Pyx_XDECREF(__pyx_t_1);
14590  __Pyx_XDECREF(__pyx_t_2);
14591  __Pyx_XDECREF(__pyx_t_4);
14592  __Pyx_XDECREF(__pyx_t_5);
14593  __Pyx_XDECREF(__pyx_t_9);
14594  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
14595  __Pyx_PyThreadState_declare
14596  __Pyx_PyThreadState_assign
14597  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
14598  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_up.rcbuffer->pybuffer);
14599  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_colind.rcbuffer->pybuffer);
14600  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer);
14601  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer);
14602  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
14603  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f_up.rcbuffer->pybuffer);
14604  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
14605  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer);
14606  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_detJ.rcbuffer->pybuffer);
14607  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dkr.rcbuffer->pybuffer);
14608  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dm.rcbuffer->pybuffer);
14609  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dmt.rcbuffer->pybuffer);
14610  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer);
14611  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer);
14612  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer);
14613  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer);
14614  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer);
14615  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer);
14616  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_m.rcbuffer->pybuffer);
14617  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_mt.rcbuffer->pybuffer);
14618  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer);
14619  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer);
14620  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer);
14621  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
14622  __Pyx_AddTraceback("subsurfaceTransportFunctions.RE_NCP1_getElementJacobian", __pyx_clineno, __pyx_lineno, __pyx_filename);
14623  __pyx_r = NULL;
14624  goto __pyx_L2;
14625  __pyx_L0:;
14626  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_a_up.rcbuffer->pybuffer);
14627  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_colind.rcbuffer->pybuffer);
14628  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementBarycentersArray.rcbuffer->pybuffer);
14629  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementJacobian.rcbuffer->pybuffer);
14630  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_elementNeighborsArray.rcbuffer->pybuffer);
14631  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_f_up.rcbuffer->pybuffer);
14632  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gravity.rcbuffer->pybuffer);
14633  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_alin.rcbuffer->pybuffer);
14634  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_detJ.rcbuffer->pybuffer);
14635  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dkr.rcbuffer->pybuffer);
14636  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dm.rcbuffer->pybuffer);
14637  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_dmt.rcbuffer->pybuffer);
14638  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_flin.rcbuffer->pybuffer);
14639  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_u.rcbuffer->pybuffer);
14640  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_v.rcbuffer->pybuffer);
14641  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_grad_w.rcbuffer->pybuffer);
14642  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr.rcbuffer->pybuffer);
14643  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_kr_up.rcbuffer->pybuffer);
14644  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_m.rcbuffer->pybuffer);
14645  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_mt.rcbuffer->pybuffer);
14646  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_r.rcbuffer->pybuffer);
14647  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q_u.rcbuffer->pybuffer);
14648  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_rowptr.rcbuffer->pybuffer);
14649  __pyx_L2:;
14650  __Pyx_XDECREF(__pyx_v_q);
14651  __Pyx_XDECREF((PyObject *)__pyx_v_a_up);
14652  __Pyx_XDECREF((PyObject *)__pyx_v_f_up);
14653  __Pyx_XGIVEREF(__pyx_r);
14654  __Pyx_RefNannyFinishContext();
14655  return __pyx_r;
14656 }
14657 
14658 /* "subsurfaceTransportFunctions.pyx":673
14659  * ##################################################
14660  *
14661  * def updateMass_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] mt, # <<<<<<<<<<<<<<
14662  * numpy.ndarray[DTYPE_t,ndim=3] w,
14663  * numpy.ndarray[DTYPE_t,ndim=2] dV,
14664  */
14665 
14666 /* Python wrapper */
14667 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_37updateMass_weakAvg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
14668 static char __pyx_doc_28subsurfaceTransportFunctions_36updateMass_weakAvg[] = "\n approximate element mass term as (\010ar{c}_e,w_{h,i})_e\n ";
14669 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_37updateMass_weakAvg = {"updateMass_weakAvg", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_37updateMass_weakAvg, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_36updateMass_weakAvg};
14670 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_37updateMass_weakAvg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
14671  PyArrayObject *__pyx_v_mt = 0;
14672  PyArrayObject *__pyx_v_w = 0;
14673  PyArrayObject *__pyx_v_dV = 0;
14674  PyArrayObject *__pyx_v_weak_residual = 0;
14675  int __pyx_lineno = 0;
14676  const char *__pyx_filename = NULL;
14677  int __pyx_clineno = 0;
14678  PyObject *__pyx_r = 0;
14679  __Pyx_RefNannyDeclarations
14680  __Pyx_RefNannySetupContext("updateMass_weakAvg (wrapper)", 0);
14681  {
14682  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_mt,&__pyx_n_s_w,&__pyx_n_s_dV,&__pyx_n_s_weak_residual,0};
14683  PyObject* values[4] = {0,0,0,0};
14684  if (unlikely(__pyx_kwds)) {
14685  Py_ssize_t kw_args;
14686  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
14687  switch (pos_args) {
14688  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
14689  CYTHON_FALLTHROUGH;
14690  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
14691  CYTHON_FALLTHROUGH;
14692  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
14693  CYTHON_FALLTHROUGH;
14694  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
14695  CYTHON_FALLTHROUGH;
14696  case 0: break;
14697  default: goto __pyx_L5_argtuple_error;
14698  }
14699  kw_args = PyDict_Size(__pyx_kwds);
14700  switch (pos_args) {
14701  case 0:
14702  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mt)) != 0)) kw_args--;
14703  else goto __pyx_L5_argtuple_error;
14704  CYTHON_FALLTHROUGH;
14705  case 1:
14706  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
14707  else {
14708  __Pyx_RaiseArgtupleInvalid("updateMass_weakAvg", 1, 4, 4, 1); __PYX_ERR(0, 673, __pyx_L3_error)
14709  }
14710  CYTHON_FALLTHROUGH;
14711  case 2:
14712  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dV)) != 0)) kw_args--;
14713  else {
14714  __Pyx_RaiseArgtupleInvalid("updateMass_weakAvg", 1, 4, 4, 2); __PYX_ERR(0, 673, __pyx_L3_error)
14715  }
14716  CYTHON_FALLTHROUGH;
14717  case 3:
14718  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_weak_residual)) != 0)) kw_args--;
14719  else {
14720  __Pyx_RaiseArgtupleInvalid("updateMass_weakAvg", 1, 4, 4, 3); __PYX_ERR(0, 673, __pyx_L3_error)
14721  }
14722  }
14723  if (unlikely(kw_args > 0)) {
14724  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "updateMass_weakAvg") < 0)) __PYX_ERR(0, 673, __pyx_L3_error)
14725  }
14726  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
14727  goto __pyx_L5_argtuple_error;
14728  } else {
14729  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
14730  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
14731  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
14732  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
14733  }
14734  __pyx_v_mt = ((PyArrayObject *)values[0]);
14735  __pyx_v_w = ((PyArrayObject *)values[1]);
14736  __pyx_v_dV = ((PyArrayObject *)values[2]);
14737  __pyx_v_weak_residual = ((PyArrayObject *)values[3]);
14738  }
14739  goto __pyx_L4_argument_unpacking_done;
14740  __pyx_L5_argtuple_error:;
14741  __Pyx_RaiseArgtupleInvalid("updateMass_weakAvg", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 673, __pyx_L3_error)
14742  __pyx_L3_error:;
14743  __Pyx_AddTraceback("subsurfaceTransportFunctions.updateMass_weakAvg", __pyx_clineno, __pyx_lineno, __pyx_filename);
14744  __Pyx_RefNannyFinishContext();
14745  return NULL;
14746  __pyx_L4_argument_unpacking_done:;
14747  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mt), __pyx_ptype_5numpy_ndarray, 1, "mt", 0))) __PYX_ERR(0, 673, __pyx_L1_error)
14748  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_w), __pyx_ptype_5numpy_ndarray, 1, "w", 0))) __PYX_ERR(0, 674, __pyx_L1_error)
14749  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dV), __pyx_ptype_5numpy_ndarray, 1, "dV", 0))) __PYX_ERR(0, 675, __pyx_L1_error)
14750  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weak_residual), __pyx_ptype_5numpy_ndarray, 1, "weak_residual", 0))) __PYX_ERR(0, 676, __pyx_L1_error)
14751  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_36updateMass_weakAvg(__pyx_self, __pyx_v_mt, __pyx_v_w, __pyx_v_dV, __pyx_v_weak_residual);
14752 
14753  /* function exit code */
14754  goto __pyx_L0;
14755  __pyx_L1_error:;
14756  __pyx_r = NULL;
14757  __pyx_L0:;
14758  __Pyx_RefNannyFinishContext();
14759  return __pyx_r;
14760 }
14761 
14762 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_36updateMass_weakAvg(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_mt, PyArrayObject *__pyx_v_w, PyArrayObject *__pyx_v_dV, PyArrayObject *__pyx_v_weak_residual) {
14763  int __pyx_v_eN;
14764  int __pyx_v_i;
14765  int __pyx_v_k;
14766  PyObject *__pyx_v_mt_avg = 0;
14767  PyObject *__pyx_v_vol = 0;
14768  __Pyx_LocalBuf_ND __pyx_pybuffernd_dV;
14769  __Pyx_Buffer __pyx_pybuffer_dV;
14770  __Pyx_LocalBuf_ND __pyx_pybuffernd_mt;
14771  __Pyx_Buffer __pyx_pybuffer_mt;
14772  __Pyx_LocalBuf_ND __pyx_pybuffernd_w;
14773  __Pyx_Buffer __pyx_pybuffer_w;
14774  __Pyx_LocalBuf_ND __pyx_pybuffernd_weak_residual;
14775  __Pyx_Buffer __pyx_pybuffer_weak_residual;
14776  PyObject *__pyx_r = NULL;
14777  __Pyx_RefNannyDeclarations
14778  npy_intp __pyx_t_1;
14779  npy_intp __pyx_t_2;
14780  int __pyx_t_3;
14781  npy_intp __pyx_t_4;
14782  npy_intp __pyx_t_5;
14783  int __pyx_t_6;
14784  Py_ssize_t __pyx_t_7;
14785  Py_ssize_t __pyx_t_8;
14786  int __pyx_t_9;
14787  Py_ssize_t __pyx_t_10;
14788  Py_ssize_t __pyx_t_11;
14789  PyObject *__pyx_t_12 = NULL;
14790  PyObject *__pyx_t_13 = NULL;
14791  PyObject *__pyx_t_14 = NULL;
14792  double __pyx_t_15;
14793  int __pyx_lineno = 0;
14794  const char *__pyx_filename = NULL;
14795  int __pyx_clineno = 0;
14796  __Pyx_RefNannySetupContext("updateMass_weakAvg", 0);
14797  __pyx_pybuffer_mt.pybuffer.buf = NULL;
14798  __pyx_pybuffer_mt.refcount = 0;
14799  __pyx_pybuffernd_mt.data = NULL;
14800  __pyx_pybuffernd_mt.rcbuffer = &__pyx_pybuffer_mt;
14801  __pyx_pybuffer_w.pybuffer.buf = NULL;
14802  __pyx_pybuffer_w.refcount = 0;
14803  __pyx_pybuffernd_w.data = NULL;
14804  __pyx_pybuffernd_w.rcbuffer = &__pyx_pybuffer_w;
14805  __pyx_pybuffer_dV.pybuffer.buf = NULL;
14806  __pyx_pybuffer_dV.refcount = 0;
14807  __pyx_pybuffernd_dV.data = NULL;
14808  __pyx_pybuffernd_dV.rcbuffer = &__pyx_pybuffer_dV;
14809  __pyx_pybuffer_weak_residual.pybuffer.buf = NULL;
14810  __pyx_pybuffer_weak_residual.refcount = 0;
14811  __pyx_pybuffernd_weak_residual.data = NULL;
14812  __pyx_pybuffernd_weak_residual.rcbuffer = &__pyx_pybuffer_weak_residual;
14813  {
14814  __Pyx_BufFmt_StackElem __pyx_stack[1];
14815  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mt.rcbuffer->pybuffer, (PyObject*)__pyx_v_mt, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 673, __pyx_L1_error)
14816  }
14817  __pyx_pybuffernd_mt.diminfo[0].strides = __pyx_pybuffernd_mt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mt.diminfo[0].shape = __pyx_pybuffernd_mt.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_mt.diminfo[1].strides = __pyx_pybuffernd_mt.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_mt.diminfo[1].shape = __pyx_pybuffernd_mt.rcbuffer->pybuffer.shape[1];
14818  {
14819  __Pyx_BufFmt_StackElem __pyx_stack[1];
14820  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_w.rcbuffer->pybuffer, (PyObject*)__pyx_v_w, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 673, __pyx_L1_error)
14821  }
14822  __pyx_pybuffernd_w.diminfo[0].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_w.diminfo[0].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_w.diminfo[1].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_w.diminfo[1].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_w.diminfo[2].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_w.diminfo[2].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[2];
14823  {
14824  __Pyx_BufFmt_StackElem __pyx_stack[1];
14825  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dV.rcbuffer->pybuffer, (PyObject*)__pyx_v_dV, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 673, __pyx_L1_error)
14826  }
14827  __pyx_pybuffernd_dV.diminfo[0].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dV.diminfo[0].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dV.diminfo[1].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dV.diminfo[1].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[1];
14828  {
14829  __Pyx_BufFmt_StackElem __pyx_stack[1];
14830  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weak_residual.rcbuffer->pybuffer, (PyObject*)__pyx_v_weak_residual, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 673, __pyx_L1_error)
14831  }
14832  __pyx_pybuffernd_weak_residual.diminfo[0].strides = __pyx_pybuffernd_weak_residual.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_weak_residual.diminfo[0].shape = __pyx_pybuffernd_weak_residual.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_weak_residual.diminfo[1].strides = __pyx_pybuffernd_weak_residual.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_weak_residual.diminfo[1].shape = __pyx_pybuffernd_weak_residual.rcbuffer->pybuffer.shape[1];
14833 
14834  /* "subsurfaceTransportFunctions.pyx":682
14835  * cdef int eN,i,k
14836  * cdef mt_avg,vol
14837  * for eN in range(mt.shape[0]): # <<<<<<<<<<<<<<
14838  * mt_avg = 0.0
14839  * vol = 0.0
14840  */
14841  __pyx_t_1 = (__pyx_v_mt->dimensions[0]);
14842  __pyx_t_2 = __pyx_t_1;
14843  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
14844  __pyx_v_eN = __pyx_t_3;
14845 
14846  /* "subsurfaceTransportFunctions.pyx":683
14847  * cdef mt_avg,vol
14848  * for eN in range(mt.shape[0]):
14849  * mt_avg = 0.0 # <<<<<<<<<<<<<<
14850  * vol = 0.0
14851  * for k in range(mt.shape[1]):
14852  */
14853  __Pyx_INCREF(__pyx_float_0_0);
14854  __Pyx_XDECREF_SET(__pyx_v_mt_avg, __pyx_float_0_0);
14855 
14856  /* "subsurfaceTransportFunctions.pyx":684
14857  * for eN in range(mt.shape[0]):
14858  * mt_avg = 0.0
14859  * vol = 0.0 # <<<<<<<<<<<<<<
14860  * for k in range(mt.shape[1]):
14861  * mt_avg += dV[eN,k]*mt[eN,k]
14862  */
14863  __Pyx_INCREF(__pyx_float_0_0);
14864  __Pyx_XDECREF_SET(__pyx_v_vol, __pyx_float_0_0);
14865 
14866  /* "subsurfaceTransportFunctions.pyx":685
14867  * mt_avg = 0.0
14868  * vol = 0.0
14869  * for k in range(mt.shape[1]): # <<<<<<<<<<<<<<
14870  * mt_avg += dV[eN,k]*mt[eN,k]
14871  * vol += dV[eN,k]
14872  */
14873  __pyx_t_4 = (__pyx_v_mt->dimensions[1]);
14874  __pyx_t_5 = __pyx_t_4;
14875  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
14876  __pyx_v_k = __pyx_t_6;
14877 
14878  /* "subsurfaceTransportFunctions.pyx":686
14879  * vol = 0.0
14880  * for k in range(mt.shape[1]):
14881  * mt_avg += dV[eN,k]*mt[eN,k] # <<<<<<<<<<<<<<
14882  * vol += dV[eN,k]
14883  * mt_avg /= vol
14884  */
14885  __pyx_t_7 = __pyx_v_eN;
14886  __pyx_t_8 = __pyx_v_k;
14887  __pyx_t_9 = -1;
14888  if (__pyx_t_7 < 0) {
14889  __pyx_t_7 += __pyx_pybuffernd_dV.diminfo[0].shape;
14890  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
14891  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_9 = 0;
14892  if (__pyx_t_8 < 0) {
14893  __pyx_t_8 += __pyx_pybuffernd_dV.diminfo[1].shape;
14894  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
14895  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_9 = 1;
14896  if (unlikely(__pyx_t_9 != -1)) {
14897  __Pyx_RaiseBufferIndexError(__pyx_t_9);
14898  __PYX_ERR(0, 686, __pyx_L1_error)
14899  }
14900  __pyx_t_10 = __pyx_v_eN;
14901  __pyx_t_11 = __pyx_v_k;
14902  __pyx_t_9 = -1;
14903  if (__pyx_t_10 < 0) {
14904  __pyx_t_10 += __pyx_pybuffernd_mt.diminfo[0].shape;
14905  if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0;
14906  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_mt.diminfo[0].shape)) __pyx_t_9 = 0;
14907  if (__pyx_t_11 < 0) {
14908  __pyx_t_11 += __pyx_pybuffernd_mt.diminfo[1].shape;
14909  if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 1;
14910  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_mt.diminfo[1].shape)) __pyx_t_9 = 1;
14911  if (unlikely(__pyx_t_9 != -1)) {
14912  __Pyx_RaiseBufferIndexError(__pyx_t_9);
14913  __PYX_ERR(0, 686, __pyx_L1_error)
14914  }
14915  __pyx_t_12 = PyFloat_FromDouble(((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_dV.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_mt.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_mt.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_mt.diminfo[1].strides)))); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 686, __pyx_L1_error)
14916  __Pyx_GOTREF(__pyx_t_12);
14917  __pyx_t_13 = PyNumber_InPlaceAdd(__pyx_v_mt_avg, __pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 686, __pyx_L1_error)
14918  __Pyx_GOTREF(__pyx_t_13);
14919  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
14920  __Pyx_DECREF_SET(__pyx_v_mt_avg, __pyx_t_13);
14921  __pyx_t_13 = 0;
14922 
14923  /* "subsurfaceTransportFunctions.pyx":687
14924  * for k in range(mt.shape[1]):
14925  * mt_avg += dV[eN,k]*mt[eN,k]
14926  * vol += dV[eN,k] # <<<<<<<<<<<<<<
14927  * mt_avg /= vol
14928  * for i in range(weak_residual.shape[1]):
14929  */
14930  __pyx_t_11 = __pyx_v_eN;
14931  __pyx_t_10 = __pyx_v_k;
14932  __pyx_t_9 = -1;
14933  if (__pyx_t_11 < 0) {
14934  __pyx_t_11 += __pyx_pybuffernd_dV.diminfo[0].shape;
14935  if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 0;
14936  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_9 = 0;
14937  if (__pyx_t_10 < 0) {
14938  __pyx_t_10 += __pyx_pybuffernd_dV.diminfo[1].shape;
14939  if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 1;
14940  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_9 = 1;
14941  if (unlikely(__pyx_t_9 != -1)) {
14942  __Pyx_RaiseBufferIndexError(__pyx_t_9);
14943  __PYX_ERR(0, 687, __pyx_L1_error)
14944  }
14945  __pyx_t_13 = PyFloat_FromDouble((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_dV.diminfo[1].strides))); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 687, __pyx_L1_error)
14946  __Pyx_GOTREF(__pyx_t_13);
14947  __pyx_t_12 = PyNumber_InPlaceAdd(__pyx_v_vol, __pyx_t_13); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 687, __pyx_L1_error)
14948  __Pyx_GOTREF(__pyx_t_12);
14949  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
14950  __Pyx_DECREF_SET(__pyx_v_vol, __pyx_t_12);
14951  __pyx_t_12 = 0;
14952  }
14953 
14954  /* "subsurfaceTransportFunctions.pyx":688
14955  * mt_avg += dV[eN,k]*mt[eN,k]
14956  * vol += dV[eN,k]
14957  * mt_avg /= vol # <<<<<<<<<<<<<<
14958  * for i in range(weak_residual.shape[1]):
14959  * #cek hack, seems like cython needed some help figuring out that the rvalue was a float
14960  */
14961  __pyx_t_12 = __Pyx_PyNumber_InPlaceDivide(__pyx_v_mt_avg, __pyx_v_vol); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 688, __pyx_L1_error)
14962  __Pyx_GOTREF(__pyx_t_12);
14963  __Pyx_DECREF_SET(__pyx_v_mt_avg, __pyx_t_12);
14964  __pyx_t_12 = 0;
14965 
14966  /* "subsurfaceTransportFunctions.pyx":689
14967  * vol += dV[eN,k]
14968  * mt_avg /= vol
14969  * for i in range(weak_residual.shape[1]): # <<<<<<<<<<<<<<
14970  * #cek hack, seems like cython needed some help figuring out that the rvalue was a float
14971  * weak_residual[eN,i] += float(mt_avg*w[eN,k,i]*dV[eN,k])
14972  */
14973  __pyx_t_4 = (__pyx_v_weak_residual->dimensions[1]);
14974  __pyx_t_5 = __pyx_t_4;
14975  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
14976  __pyx_v_i = __pyx_t_6;
14977 
14978  /* "subsurfaceTransportFunctions.pyx":691
14979  * for i in range(weak_residual.shape[1]):
14980  * #cek hack, seems like cython needed some help figuring out that the rvalue was a float
14981  * weak_residual[eN,i] += float(mt_avg*w[eN,k,i]*dV[eN,k]) # <<<<<<<<<<<<<<
14982  * def updateMassJacobian_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] dmt,
14983  * numpy.ndarray[DTYPE_t,ndim=3] w,
14984  */
14985  __pyx_t_10 = __pyx_v_eN;
14986  __pyx_t_11 = __pyx_v_k;
14987  __pyx_t_8 = __pyx_v_i;
14988  __pyx_t_9 = -1;
14989  if (__pyx_t_10 < 0) {
14990  __pyx_t_10 += __pyx_pybuffernd_w.diminfo[0].shape;
14991  if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0;
14992  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_w.diminfo[0].shape)) __pyx_t_9 = 0;
14993  if (__pyx_t_11 < 0) {
14994  __pyx_t_11 += __pyx_pybuffernd_w.diminfo[1].shape;
14995  if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 1;
14996  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_w.diminfo[1].shape)) __pyx_t_9 = 1;
14997  if (__pyx_t_8 < 0) {
14998  __pyx_t_8 += __pyx_pybuffernd_w.diminfo[2].shape;
14999  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 2;
15000  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_w.diminfo[2].shape)) __pyx_t_9 = 2;
15001  if (unlikely(__pyx_t_9 != -1)) {
15002  __Pyx_RaiseBufferIndexError(__pyx_t_9);
15003  __PYX_ERR(0, 691, __pyx_L1_error)
15004  }
15005  __pyx_t_12 = PyFloat_FromDouble((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_w.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_w.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_w.diminfo[1].strides, __pyx_t_8, __pyx_pybuffernd_w.diminfo[2].strides))); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 691, __pyx_L1_error)
15006  __Pyx_GOTREF(__pyx_t_12);
15007  __pyx_t_13 = PyNumber_Multiply(__pyx_v_mt_avg, __pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 691, __pyx_L1_error)
15008  __Pyx_GOTREF(__pyx_t_13);
15009  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
15010  __pyx_t_8 = __pyx_v_eN;
15011  __pyx_t_11 = __pyx_v_k;
15012  __pyx_t_9 = -1;
15013  if (__pyx_t_8 < 0) {
15014  __pyx_t_8 += __pyx_pybuffernd_dV.diminfo[0].shape;
15015  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0;
15016  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_9 = 0;
15017  if (__pyx_t_11 < 0) {
15018  __pyx_t_11 += __pyx_pybuffernd_dV.diminfo[1].shape;
15019  if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 1;
15020  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_9 = 1;
15021  if (unlikely(__pyx_t_9 != -1)) {
15022  __Pyx_RaiseBufferIndexError(__pyx_t_9);
15023  __PYX_ERR(0, 691, __pyx_L1_error)
15024  }
15025  __pyx_t_12 = PyFloat_FromDouble((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_dV.diminfo[1].strides))); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 691, __pyx_L1_error)
15026  __Pyx_GOTREF(__pyx_t_12);
15027  __pyx_t_14 = PyNumber_Multiply(__pyx_t_13, __pyx_t_12); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 691, __pyx_L1_error)
15028  __Pyx_GOTREF(__pyx_t_14);
15029  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
15030  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
15031  __pyx_t_15 = __Pyx_PyObject_AsDouble(__pyx_t_14); if (unlikely(__pyx_t_15 == ((double)((double)-1)) && PyErr_Occurred())) __PYX_ERR(0, 691, __pyx_L1_error)
15032  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
15033  __pyx_t_11 = __pyx_v_eN;
15034  __pyx_t_8 = __pyx_v_i;
15035  __pyx_t_9 = -1;
15036  if (__pyx_t_11 < 0) {
15037  __pyx_t_11 += __pyx_pybuffernd_weak_residual.diminfo[0].shape;
15038  if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 0;
15039  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_weak_residual.diminfo[0].shape)) __pyx_t_9 = 0;
15040  if (__pyx_t_8 < 0) {
15041  __pyx_t_8 += __pyx_pybuffernd_weak_residual.diminfo[1].shape;
15042  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
15043  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_weak_residual.diminfo[1].shape)) __pyx_t_9 = 1;
15044  if (unlikely(__pyx_t_9 != -1)) {
15045  __Pyx_RaiseBufferIndexError(__pyx_t_9);
15046  __PYX_ERR(0, 691, __pyx_L1_error)
15047  }
15048  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_weak_residual.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_weak_residual.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_weak_residual.diminfo[1].strides) += __pyx_t_15;
15049  }
15050  }
15051 
15052  /* "subsurfaceTransportFunctions.pyx":673
15053  * ##################################################
15054  *
15055  * def updateMass_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] mt, # <<<<<<<<<<<<<<
15056  * numpy.ndarray[DTYPE_t,ndim=3] w,
15057  * numpy.ndarray[DTYPE_t,ndim=2] dV,
15058  */
15059 
15060  /* function exit code */
15061  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
15062  goto __pyx_L0;
15063  __pyx_L1_error:;
15064  __Pyx_XDECREF(__pyx_t_12);
15065  __Pyx_XDECREF(__pyx_t_13);
15066  __Pyx_XDECREF(__pyx_t_14);
15067  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
15068  __Pyx_PyThreadState_declare
15069  __Pyx_PyThreadState_assign
15070  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
15071  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
15072  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mt.rcbuffer->pybuffer);
15073  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_w.rcbuffer->pybuffer);
15074  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weak_residual.rcbuffer->pybuffer);
15075  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
15076  __Pyx_AddTraceback("subsurfaceTransportFunctions.updateMass_weakAvg", __pyx_clineno, __pyx_lineno, __pyx_filename);
15077  __pyx_r = NULL;
15078  goto __pyx_L2;
15079  __pyx_L0:;
15080  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
15081  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mt.rcbuffer->pybuffer);
15082  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_w.rcbuffer->pybuffer);
15083  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weak_residual.rcbuffer->pybuffer);
15084  __pyx_L2:;
15085  __Pyx_XDECREF(__pyx_v_mt_avg);
15086  __Pyx_XDECREF(__pyx_v_vol);
15087  __Pyx_XGIVEREF(__pyx_r);
15088  __Pyx_RefNannyFinishContext();
15089  return __pyx_r;
15090 }
15091 
15092 /* "subsurfaceTransportFunctions.pyx":692
15093  * #cek hack, seems like cython needed some help figuring out that the rvalue was a float
15094  * weak_residual[eN,i] += float(mt_avg*w[eN,k,i]*dV[eN,k])
15095  * def updateMassJacobian_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] dmt, # <<<<<<<<<<<<<<
15096  * numpy.ndarray[DTYPE_t,ndim=3] w,
15097  * numpy.ndarray[DTYPE_t,ndim=3] v,
15098  */
15099 
15100 /* Python wrapper */
15101 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_39updateMassJacobian_weakAvg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
15102 static char __pyx_doc_28subsurfaceTransportFunctions_38updateMassJacobian_weakAvg[] = "\n approximate element mass Jacobian term as (\\pd{\010ar{c}_e}{u_j},w_{h,i})_e\n ";
15103 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_39updateMassJacobian_weakAvg = {"updateMassJacobian_weakAvg", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_39updateMassJacobian_weakAvg, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_38updateMassJacobian_weakAvg};
15104 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_39updateMassJacobian_weakAvg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
15105  PyArrayObject *__pyx_v_dmt = 0;
15106  PyArrayObject *__pyx_v_w = 0;
15107  PyArrayObject *__pyx_v_v = 0;
15108  PyArrayObject *__pyx_v_dV = 0;
15109  PyArrayObject *__pyx_v_jacobian_weak_residual = 0;
15110  int __pyx_lineno = 0;
15111  const char *__pyx_filename = NULL;
15112  int __pyx_clineno = 0;
15113  PyObject *__pyx_r = 0;
15114  __Pyx_RefNannyDeclarations
15115  __Pyx_RefNannySetupContext("updateMassJacobian_weakAvg (wrapper)", 0);
15116  {
15117  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dmt,&__pyx_n_s_w,&__pyx_n_s_v,&__pyx_n_s_dV,&__pyx_n_s_jacobian_weak_residual,0};
15118  PyObject* values[5] = {0,0,0,0,0};
15119  if (unlikely(__pyx_kwds)) {
15120  Py_ssize_t kw_args;
15121  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
15122  switch (pos_args) {
15123  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
15124  CYTHON_FALLTHROUGH;
15125  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
15126  CYTHON_FALLTHROUGH;
15127  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
15128  CYTHON_FALLTHROUGH;
15129  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15130  CYTHON_FALLTHROUGH;
15131  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15132  CYTHON_FALLTHROUGH;
15133  case 0: break;
15134  default: goto __pyx_L5_argtuple_error;
15135  }
15136  kw_args = PyDict_Size(__pyx_kwds);
15137  switch (pos_args) {
15138  case 0:
15139  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dmt)) != 0)) kw_args--;
15140  else goto __pyx_L5_argtuple_error;
15141  CYTHON_FALLTHROUGH;
15142  case 1:
15143  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
15144  else {
15145  __Pyx_RaiseArgtupleInvalid("updateMassJacobian_weakAvg", 1, 5, 5, 1); __PYX_ERR(0, 692, __pyx_L3_error)
15146  }
15147  CYTHON_FALLTHROUGH;
15148  case 2:
15149  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
15150  else {
15151  __Pyx_RaiseArgtupleInvalid("updateMassJacobian_weakAvg", 1, 5, 5, 2); __PYX_ERR(0, 692, __pyx_L3_error)
15152  }
15153  CYTHON_FALLTHROUGH;
15154  case 3:
15155  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dV)) != 0)) kw_args--;
15156  else {
15157  __Pyx_RaiseArgtupleInvalid("updateMassJacobian_weakAvg", 1, 5, 5, 3); __PYX_ERR(0, 692, __pyx_L3_error)
15158  }
15159  CYTHON_FALLTHROUGH;
15160  case 4:
15161  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_jacobian_weak_residual)) != 0)) kw_args--;
15162  else {
15163  __Pyx_RaiseArgtupleInvalid("updateMassJacobian_weakAvg", 1, 5, 5, 4); __PYX_ERR(0, 692, __pyx_L3_error)
15164  }
15165  }
15166  if (unlikely(kw_args > 0)) {
15167  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "updateMassJacobian_weakAvg") < 0)) __PYX_ERR(0, 692, __pyx_L3_error)
15168  }
15169  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
15170  goto __pyx_L5_argtuple_error;
15171  } else {
15172  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15173  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15174  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
15175  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
15176  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
15177  }
15178  __pyx_v_dmt = ((PyArrayObject *)values[0]);
15179  __pyx_v_w = ((PyArrayObject *)values[1]);
15180  __pyx_v_v = ((PyArrayObject *)values[2]);
15181  __pyx_v_dV = ((PyArrayObject *)values[3]);
15182  __pyx_v_jacobian_weak_residual = ((PyArrayObject *)values[4]);
15183  }
15184  goto __pyx_L4_argument_unpacking_done;
15185  __pyx_L5_argtuple_error:;
15186  __Pyx_RaiseArgtupleInvalid("updateMassJacobian_weakAvg", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 692, __pyx_L3_error)
15187  __pyx_L3_error:;
15188  __Pyx_AddTraceback("subsurfaceTransportFunctions.updateMassJacobian_weakAvg", __pyx_clineno, __pyx_lineno, __pyx_filename);
15189  __Pyx_RefNannyFinishContext();
15190  return NULL;
15191  __pyx_L4_argument_unpacking_done:;
15192  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dmt), __pyx_ptype_5numpy_ndarray, 1, "dmt", 0))) __PYX_ERR(0, 692, __pyx_L1_error)
15193  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_w), __pyx_ptype_5numpy_ndarray, 1, "w", 0))) __PYX_ERR(0, 693, __pyx_L1_error)
15194  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 694, __pyx_L1_error)
15195  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dV), __pyx_ptype_5numpy_ndarray, 1, "dV", 0))) __PYX_ERR(0, 695, __pyx_L1_error)
15196  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_jacobian_weak_residual), __pyx_ptype_5numpy_ndarray, 1, "jacobian_weak_residual", 0))) __PYX_ERR(0, 696, __pyx_L1_error)
15197  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_38updateMassJacobian_weakAvg(__pyx_self, __pyx_v_dmt, __pyx_v_w, __pyx_v_v, __pyx_v_dV, __pyx_v_jacobian_weak_residual);
15198 
15199  /* function exit code */
15200  goto __pyx_L0;
15201  __pyx_L1_error:;
15202  __pyx_r = NULL;
15203  __pyx_L0:;
15204  __Pyx_RefNannyFinishContext();
15205  return __pyx_r;
15206 }
15207 
15208 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_38updateMassJacobian_weakAvg(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_dmt, PyArrayObject *__pyx_v_w, PyArrayObject *__pyx_v_v, PyArrayObject *__pyx_v_dV, PyArrayObject *__pyx_v_jacobian_weak_residual) {
15209  int __pyx_v_eN;
15210  int __pyx_v_i;
15211  int __pyx_v_j;
15212  int __pyx_v_k;
15213  double __pyx_v_dmtj_avg;
15214  double __pyx_v_vol;
15215  __Pyx_LocalBuf_ND __pyx_pybuffernd_dV;
15216  __Pyx_Buffer __pyx_pybuffer_dV;
15217  __Pyx_LocalBuf_ND __pyx_pybuffernd_dmt;
15218  __Pyx_Buffer __pyx_pybuffer_dmt;
15219  __Pyx_LocalBuf_ND __pyx_pybuffernd_jacobian_weak_residual;
15220  __Pyx_Buffer __pyx_pybuffer_jacobian_weak_residual;
15221  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
15222  __Pyx_Buffer __pyx_pybuffer_v;
15223  __Pyx_LocalBuf_ND __pyx_pybuffernd_w;
15224  __Pyx_Buffer __pyx_pybuffer_w;
15225  PyObject *__pyx_r = NULL;
15226  __Pyx_RefNannyDeclarations
15227  npy_intp __pyx_t_1;
15228  npy_intp __pyx_t_2;
15229  int __pyx_t_3;
15230  npy_intp __pyx_t_4;
15231  npy_intp __pyx_t_5;
15232  int __pyx_t_6;
15233  Py_ssize_t __pyx_t_7;
15234  Py_ssize_t __pyx_t_8;
15235  int __pyx_t_9;
15236  npy_intp __pyx_t_10;
15237  npy_intp __pyx_t_11;
15238  npy_intp __pyx_t_12;
15239  npy_intp __pyx_t_13;
15240  int __pyx_t_14;
15241  int __pyx_t_15;
15242  Py_ssize_t __pyx_t_16;
15243  Py_ssize_t __pyx_t_17;
15244  Py_ssize_t __pyx_t_18;
15245  Py_ssize_t __pyx_t_19;
15246  Py_ssize_t __pyx_t_20;
15247  Py_ssize_t __pyx_t_21;
15248  int __pyx_lineno = 0;
15249  const char *__pyx_filename = NULL;
15250  int __pyx_clineno = 0;
15251  __Pyx_RefNannySetupContext("updateMassJacobian_weakAvg", 0);
15252  __pyx_pybuffer_dmt.pybuffer.buf = NULL;
15253  __pyx_pybuffer_dmt.refcount = 0;
15254  __pyx_pybuffernd_dmt.data = NULL;
15255  __pyx_pybuffernd_dmt.rcbuffer = &__pyx_pybuffer_dmt;
15256  __pyx_pybuffer_w.pybuffer.buf = NULL;
15257  __pyx_pybuffer_w.refcount = 0;
15258  __pyx_pybuffernd_w.data = NULL;
15259  __pyx_pybuffernd_w.rcbuffer = &__pyx_pybuffer_w;
15260  __pyx_pybuffer_v.pybuffer.buf = NULL;
15261  __pyx_pybuffer_v.refcount = 0;
15262  __pyx_pybuffernd_v.data = NULL;
15263  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
15264  __pyx_pybuffer_dV.pybuffer.buf = NULL;
15265  __pyx_pybuffer_dV.refcount = 0;
15266  __pyx_pybuffernd_dV.data = NULL;
15267  __pyx_pybuffernd_dV.rcbuffer = &__pyx_pybuffer_dV;
15268  __pyx_pybuffer_jacobian_weak_residual.pybuffer.buf = NULL;
15269  __pyx_pybuffer_jacobian_weak_residual.refcount = 0;
15270  __pyx_pybuffernd_jacobian_weak_residual.data = NULL;
15271  __pyx_pybuffernd_jacobian_weak_residual.rcbuffer = &__pyx_pybuffer_jacobian_weak_residual;
15272  {
15273  __Pyx_BufFmt_StackElem __pyx_stack[1];
15274  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dmt.rcbuffer->pybuffer, (PyObject*)__pyx_v_dmt, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 692, __pyx_L1_error)
15275  }
15276  __pyx_pybuffernd_dmt.diminfo[0].strides = __pyx_pybuffernd_dmt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dmt.diminfo[0].shape = __pyx_pybuffernd_dmt.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dmt.diminfo[1].strides = __pyx_pybuffernd_dmt.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dmt.diminfo[1].shape = __pyx_pybuffernd_dmt.rcbuffer->pybuffer.shape[1];
15277  {
15278  __Pyx_BufFmt_StackElem __pyx_stack[1];
15279  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_w.rcbuffer->pybuffer, (PyObject*)__pyx_v_w, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 692, __pyx_L1_error)
15280  }
15281  __pyx_pybuffernd_w.diminfo[0].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_w.diminfo[0].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_w.diminfo[1].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_w.diminfo[1].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_w.diminfo[2].strides = __pyx_pybuffernd_w.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_w.diminfo[2].shape = __pyx_pybuffernd_w.rcbuffer->pybuffer.shape[2];
15282  {
15283  __Pyx_BufFmt_StackElem __pyx_stack[1];
15284  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 692, __pyx_L1_error)
15285  }
15286  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2];
15287  {
15288  __Pyx_BufFmt_StackElem __pyx_stack[1];
15289  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dV.rcbuffer->pybuffer, (PyObject*)__pyx_v_dV, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 692, __pyx_L1_error)
15290  }
15291  __pyx_pybuffernd_dV.diminfo[0].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dV.diminfo[0].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dV.diminfo[1].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dV.diminfo[1].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[1];
15292  {
15293  __Pyx_BufFmt_StackElem __pyx_stack[1];
15294  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer, (PyObject*)__pyx_v_jacobian_weak_residual, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 692, __pyx_L1_error)
15295  }
15296  __pyx_pybuffernd_jacobian_weak_residual.diminfo[0].strides = __pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_jacobian_weak_residual.diminfo[0].shape = __pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_jacobian_weak_residual.diminfo[1].strides = __pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_jacobian_weak_residual.diminfo[1].shape = __pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_jacobian_weak_residual.diminfo[2].strides = __pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_jacobian_weak_residual.diminfo[2].shape = __pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer.shape[2];
15297 
15298  /* "subsurfaceTransportFunctions.pyx":702
15299  * cdef int eN,i,j,k
15300  * cdef double dmtj_avg,vol
15301  * for eN in range(dmt.shape[0]): # <<<<<<<<<<<<<<
15302  * vol = 0.0 #should I save a loop?
15303  * for k in range(dmt.shape[1]):
15304  */
15305  __pyx_t_1 = (__pyx_v_dmt->dimensions[0]);
15306  __pyx_t_2 = __pyx_t_1;
15307  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
15308  __pyx_v_eN = __pyx_t_3;
15309 
15310  /* "subsurfaceTransportFunctions.pyx":703
15311  * cdef double dmtj_avg,vol
15312  * for eN in range(dmt.shape[0]):
15313  * vol = 0.0 #should I save a loop? # <<<<<<<<<<<<<<
15314  * for k in range(dmt.shape[1]):
15315  * vol += dV[eN,k]
15316  */
15317  __pyx_v_vol = 0.0;
15318 
15319  /* "subsurfaceTransportFunctions.pyx":704
15320  * for eN in range(dmt.shape[0]):
15321  * vol = 0.0 #should I save a loop?
15322  * for k in range(dmt.shape[1]): # <<<<<<<<<<<<<<
15323  * vol += dV[eN,k]
15324  * for i in range(w.shape[2]):
15325  */
15326  __pyx_t_4 = (__pyx_v_dmt->dimensions[1]);
15327  __pyx_t_5 = __pyx_t_4;
15328  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
15329  __pyx_v_k = __pyx_t_6;
15330 
15331  /* "subsurfaceTransportFunctions.pyx":705
15332  * vol = 0.0 #should I save a loop?
15333  * for k in range(dmt.shape[1]):
15334  * vol += dV[eN,k] # <<<<<<<<<<<<<<
15335  * for i in range(w.shape[2]):
15336  * for j in range(v.shape[2]):
15337  */
15338  __pyx_t_7 = __pyx_v_eN;
15339  __pyx_t_8 = __pyx_v_k;
15340  __pyx_t_9 = -1;
15341  if (__pyx_t_7 < 0) {
15342  __pyx_t_7 += __pyx_pybuffernd_dV.diminfo[0].shape;
15343  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
15344  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_9 = 0;
15345  if (__pyx_t_8 < 0) {
15346  __pyx_t_8 += __pyx_pybuffernd_dV.diminfo[1].shape;
15347  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
15348  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_9 = 1;
15349  if (unlikely(__pyx_t_9 != -1)) {
15350  __Pyx_RaiseBufferIndexError(__pyx_t_9);
15351  __PYX_ERR(0, 705, __pyx_L1_error)
15352  }
15353  __pyx_v_vol = (__pyx_v_vol + (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_dV.diminfo[1].strides)));
15354  }
15355 
15356  /* "subsurfaceTransportFunctions.pyx":706
15357  * for k in range(dmt.shape[1]):
15358  * vol += dV[eN,k]
15359  * for i in range(w.shape[2]): # <<<<<<<<<<<<<<
15360  * for j in range(v.shape[2]):
15361  * dmtj_avg = 0.0
15362  */
15363  __pyx_t_4 = (__pyx_v_w->dimensions[2]);
15364  __pyx_t_5 = __pyx_t_4;
15365  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
15366  __pyx_v_i = __pyx_t_6;
15367 
15368  /* "subsurfaceTransportFunctions.pyx":707
15369  * vol += dV[eN,k]
15370  * for i in range(w.shape[2]):
15371  * for j in range(v.shape[2]): # <<<<<<<<<<<<<<
15372  * dmtj_avg = 0.0
15373  * for k in range(dmt.shape[1]):
15374  */
15375  __pyx_t_10 = (__pyx_v_v->dimensions[2]);
15376  __pyx_t_11 = __pyx_t_10;
15377  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_11; __pyx_t_9+=1) {
15378  __pyx_v_j = __pyx_t_9;
15379 
15380  /* "subsurfaceTransportFunctions.pyx":708
15381  * for i in range(w.shape[2]):
15382  * for j in range(v.shape[2]):
15383  * dmtj_avg = 0.0 # <<<<<<<<<<<<<<
15384  * for k in range(dmt.shape[1]):
15385  * dmtj_avg += dV[eN,k]*dmt[eN,k]*v[eN,k,j]
15386  */
15387  __pyx_v_dmtj_avg = 0.0;
15388 
15389  /* "subsurfaceTransportFunctions.pyx":709
15390  * for j in range(v.shape[2]):
15391  * dmtj_avg = 0.0
15392  * for k in range(dmt.shape[1]): # <<<<<<<<<<<<<<
15393  * dmtj_avg += dV[eN,k]*dmt[eN,k]*v[eN,k,j]
15394  * dmtj_avg /= vol
15395  */
15396  __pyx_t_12 = (__pyx_v_dmt->dimensions[1]);
15397  __pyx_t_13 = __pyx_t_12;
15398  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
15399  __pyx_v_k = __pyx_t_14;
15400 
15401  /* "subsurfaceTransportFunctions.pyx":710
15402  * dmtj_avg = 0.0
15403  * for k in range(dmt.shape[1]):
15404  * dmtj_avg += dV[eN,k]*dmt[eN,k]*v[eN,k,j] # <<<<<<<<<<<<<<
15405  * dmtj_avg /= vol
15406  * jacobian_weak_residual[eN,i,j] += dmtj_avg*w[eN,k,i]*dV[eN,k]
15407  */
15408  __pyx_t_8 = __pyx_v_eN;
15409  __pyx_t_7 = __pyx_v_k;
15410  __pyx_t_15 = -1;
15411  if (__pyx_t_8 < 0) {
15412  __pyx_t_8 += __pyx_pybuffernd_dV.diminfo[0].shape;
15413  if (unlikely(__pyx_t_8 < 0)) __pyx_t_15 = 0;
15414  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_15 = 0;
15415  if (__pyx_t_7 < 0) {
15416  __pyx_t_7 += __pyx_pybuffernd_dV.diminfo[1].shape;
15417  if (unlikely(__pyx_t_7 < 0)) __pyx_t_15 = 1;
15418  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_15 = 1;
15419  if (unlikely(__pyx_t_15 != -1)) {
15420  __Pyx_RaiseBufferIndexError(__pyx_t_15);
15421  __PYX_ERR(0, 710, __pyx_L1_error)
15422  }
15423  __pyx_t_16 = __pyx_v_eN;
15424  __pyx_t_17 = __pyx_v_k;
15425  __pyx_t_15 = -1;
15426  if (__pyx_t_16 < 0) {
15427  __pyx_t_16 += __pyx_pybuffernd_dmt.diminfo[0].shape;
15428  if (unlikely(__pyx_t_16 < 0)) __pyx_t_15 = 0;
15429  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_dmt.diminfo[0].shape)) __pyx_t_15 = 0;
15430  if (__pyx_t_17 < 0) {
15431  __pyx_t_17 += __pyx_pybuffernd_dmt.diminfo[1].shape;
15432  if (unlikely(__pyx_t_17 < 0)) __pyx_t_15 = 1;
15433  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_dmt.diminfo[1].shape)) __pyx_t_15 = 1;
15434  if (unlikely(__pyx_t_15 != -1)) {
15435  __Pyx_RaiseBufferIndexError(__pyx_t_15);
15436  __PYX_ERR(0, 710, __pyx_L1_error)
15437  }
15438  __pyx_t_18 = __pyx_v_eN;
15439  __pyx_t_19 = __pyx_v_k;
15440  __pyx_t_20 = __pyx_v_j;
15441  __pyx_t_15 = -1;
15442  if (__pyx_t_18 < 0) {
15443  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[0].shape;
15444  if (unlikely(__pyx_t_18 < 0)) __pyx_t_15 = 0;
15445  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
15446  if (__pyx_t_19 < 0) {
15447  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[1].shape;
15448  if (unlikely(__pyx_t_19 < 0)) __pyx_t_15 = 1;
15449  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
15450  if (__pyx_t_20 < 0) {
15451  __pyx_t_20 += __pyx_pybuffernd_v.diminfo[2].shape;
15452  if (unlikely(__pyx_t_20 < 0)) __pyx_t_15 = 2;
15453  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
15454  if (unlikely(__pyx_t_15 != -1)) {
15455  __Pyx_RaiseBufferIndexError(__pyx_t_15);
15456  __PYX_ERR(0, 710, __pyx_L1_error)
15457  }
15458  __pyx_v_dmtj_avg = (__pyx_v_dmtj_avg + (((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_dV.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dmt.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_dmt.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_dmt.diminfo[1].strides))) * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_20, __pyx_pybuffernd_v.diminfo[2].strides))));
15459  }
15460 
15461  /* "subsurfaceTransportFunctions.pyx":711
15462  * for k in range(dmt.shape[1]):
15463  * dmtj_avg += dV[eN,k]*dmt[eN,k]*v[eN,k,j]
15464  * dmtj_avg /= vol # <<<<<<<<<<<<<<
15465  * jacobian_weak_residual[eN,i,j] += dmtj_avg*w[eN,k,i]*dV[eN,k]
15466  *
15467  */
15468  if (unlikely(__pyx_v_vol == 0)) {
15469  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
15470  __PYX_ERR(0, 711, __pyx_L1_error)
15471  }
15472  __pyx_v_dmtj_avg = (__pyx_v_dmtj_avg / __pyx_v_vol);
15473 
15474  /* "subsurfaceTransportFunctions.pyx":712
15475  * dmtj_avg += dV[eN,k]*dmt[eN,k]*v[eN,k,j]
15476  * dmtj_avg /= vol
15477  * jacobian_weak_residual[eN,i,j] += dmtj_avg*w[eN,k,i]*dV[eN,k] # <<<<<<<<<<<<<<
15478  *
15479  * ########################################################################
15480  */
15481  __pyx_t_20 = __pyx_v_eN;
15482  __pyx_t_19 = __pyx_v_k;
15483  __pyx_t_18 = __pyx_v_i;
15484  __pyx_t_14 = -1;
15485  if (__pyx_t_20 < 0) {
15486  __pyx_t_20 += __pyx_pybuffernd_w.diminfo[0].shape;
15487  if (unlikely(__pyx_t_20 < 0)) __pyx_t_14 = 0;
15488  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_w.diminfo[0].shape)) __pyx_t_14 = 0;
15489  if (__pyx_t_19 < 0) {
15490  __pyx_t_19 += __pyx_pybuffernd_w.diminfo[1].shape;
15491  if (unlikely(__pyx_t_19 < 0)) __pyx_t_14 = 1;
15492  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_w.diminfo[1].shape)) __pyx_t_14 = 1;
15493  if (__pyx_t_18 < 0) {
15494  __pyx_t_18 += __pyx_pybuffernd_w.diminfo[2].shape;
15495  if (unlikely(__pyx_t_18 < 0)) __pyx_t_14 = 2;
15496  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_w.diminfo[2].shape)) __pyx_t_14 = 2;
15497  if (unlikely(__pyx_t_14 != -1)) {
15498  __Pyx_RaiseBufferIndexError(__pyx_t_14);
15499  __PYX_ERR(0, 712, __pyx_L1_error)
15500  }
15501  __pyx_t_17 = __pyx_v_eN;
15502  __pyx_t_16 = __pyx_v_k;
15503  __pyx_t_14 = -1;
15504  if (__pyx_t_17 < 0) {
15505  __pyx_t_17 += __pyx_pybuffernd_dV.diminfo[0].shape;
15506  if (unlikely(__pyx_t_17 < 0)) __pyx_t_14 = 0;
15507  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_14 = 0;
15508  if (__pyx_t_16 < 0) {
15509  __pyx_t_16 += __pyx_pybuffernd_dV.diminfo[1].shape;
15510  if (unlikely(__pyx_t_16 < 0)) __pyx_t_14 = 1;
15511  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_14 = 1;
15512  if (unlikely(__pyx_t_14 != -1)) {
15513  __Pyx_RaiseBufferIndexError(__pyx_t_14);
15514  __PYX_ERR(0, 712, __pyx_L1_error)
15515  }
15516  __pyx_t_7 = __pyx_v_eN;
15517  __pyx_t_8 = __pyx_v_i;
15518  __pyx_t_21 = __pyx_v_j;
15519  __pyx_t_14 = -1;
15520  if (__pyx_t_7 < 0) {
15521  __pyx_t_7 += __pyx_pybuffernd_jacobian_weak_residual.diminfo[0].shape;
15522  if (unlikely(__pyx_t_7 < 0)) __pyx_t_14 = 0;
15523  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_jacobian_weak_residual.diminfo[0].shape)) __pyx_t_14 = 0;
15524  if (__pyx_t_8 < 0) {
15525  __pyx_t_8 += __pyx_pybuffernd_jacobian_weak_residual.diminfo[1].shape;
15526  if (unlikely(__pyx_t_8 < 0)) __pyx_t_14 = 1;
15527  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_jacobian_weak_residual.diminfo[1].shape)) __pyx_t_14 = 1;
15528  if (__pyx_t_21 < 0) {
15529  __pyx_t_21 += __pyx_pybuffernd_jacobian_weak_residual.diminfo[2].shape;
15530  if (unlikely(__pyx_t_21 < 0)) __pyx_t_14 = 2;
15531  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_jacobian_weak_residual.diminfo[2].shape)) __pyx_t_14 = 2;
15532  if (unlikely(__pyx_t_14 != -1)) {
15533  __Pyx_RaiseBufferIndexError(__pyx_t_14);
15534  __PYX_ERR(0, 712, __pyx_L1_error)
15535  }
15536  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_jacobian_weak_residual.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_jacobian_weak_residual.diminfo[1].strides, __pyx_t_21, __pyx_pybuffernd_jacobian_weak_residual.diminfo[2].strides) += ((__pyx_v_dmtj_avg * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_w.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_w.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_w.diminfo[1].strides, __pyx_t_18, __pyx_pybuffernd_w.diminfo[2].strides))) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_dV.diminfo[1].strides)));
15537  }
15538  }
15539  }
15540 
15541  /* "subsurfaceTransportFunctions.pyx":692
15542  * #cek hack, seems like cython needed some help figuring out that the rvalue was a float
15543  * weak_residual[eN,i] += float(mt_avg*w[eN,k,i]*dV[eN,k])
15544  * def updateMassJacobian_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] dmt, # <<<<<<<<<<<<<<
15545  * numpy.ndarray[DTYPE_t,ndim=3] w,
15546  * numpy.ndarray[DTYPE_t,ndim=3] v,
15547  */
15548 
15549  /* function exit code */
15550  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
15551  goto __pyx_L0;
15552  __pyx_L1_error:;
15553  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
15554  __Pyx_PyThreadState_declare
15555  __Pyx_PyThreadState_assign
15556  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
15557  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
15558  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dmt.rcbuffer->pybuffer);
15559  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer);
15560  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
15561  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_w.rcbuffer->pybuffer);
15562  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
15563  __Pyx_AddTraceback("subsurfaceTransportFunctions.updateMassJacobian_weakAvg", __pyx_clineno, __pyx_lineno, __pyx_filename);
15564  __pyx_r = NULL;
15565  goto __pyx_L2;
15566  __pyx_L0:;
15567  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
15568  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dmt.rcbuffer->pybuffer);
15569  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_jacobian_weak_residual.rcbuffer->pybuffer);
15570  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
15571  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_w.rcbuffer->pybuffer);
15572  __pyx_L2:;
15573  __Pyx_XGIVEREF(__pyx_r);
15574  __Pyx_RefNannyFinishContext();
15575  return __pyx_r;
15576 }
15577 
15578 /* "subsurfaceTransportFunctions.pyx":717
15579  * #ELLAM
15580  * ########################################################################
15581  * def calculateNormalFlux(numpy.ndarray[DTYPE_t,ndim=4] v, # <<<<<<<<<<<<<<
15582  * numpy.ndarray[DTYPE_t,ndim=4] n,
15583  * numpy.ndarray[DTYPE_t,ndim=3] dS,
15584  */
15585 
15586 /* Python wrapper */
15587 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_41calculateNormalFlux(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
15588 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_41calculateNormalFlux = {"calculateNormalFlux", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_41calculateNormalFlux, METH_VARARGS|METH_KEYWORDS, 0};
15589 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_41calculateNormalFlux(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
15590  PyArrayObject *__pyx_v_v = 0;
15591  PyArrayObject *__pyx_v_n = 0;
15592  PyArrayObject *__pyx_v_dS = 0;
15593  PyArrayObject *__pyx_v_flux = 0;
15594  int __pyx_lineno = 0;
15595  const char *__pyx_filename = NULL;
15596  int __pyx_clineno = 0;
15597  PyObject *__pyx_r = 0;
15598  __Pyx_RefNannyDeclarations
15599  __Pyx_RefNannySetupContext("calculateNormalFlux (wrapper)", 0);
15600  {
15601  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_v,&__pyx_n_s_n,&__pyx_n_s_dS,&__pyx_n_s_flux,0};
15602  PyObject* values[4] = {0,0,0,0};
15603  if (unlikely(__pyx_kwds)) {
15604  Py_ssize_t kw_args;
15605  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
15606  switch (pos_args) {
15607  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
15608  CYTHON_FALLTHROUGH;
15609  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
15610  CYTHON_FALLTHROUGH;
15611  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15612  CYTHON_FALLTHROUGH;
15613  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15614  CYTHON_FALLTHROUGH;
15615  case 0: break;
15616  default: goto __pyx_L5_argtuple_error;
15617  }
15618  kw_args = PyDict_Size(__pyx_kwds);
15619  switch (pos_args) {
15620  case 0:
15621  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
15622  else goto __pyx_L5_argtuple_error;
15623  CYTHON_FALLTHROUGH;
15624  case 1:
15625  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
15626  else {
15627  __Pyx_RaiseArgtupleInvalid("calculateNormalFlux", 1, 4, 4, 1); __PYX_ERR(0, 717, __pyx_L3_error)
15628  }
15629  CYTHON_FALLTHROUGH;
15630  case 2:
15631  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dS)) != 0)) kw_args--;
15632  else {
15633  __Pyx_RaiseArgtupleInvalid("calculateNormalFlux", 1, 4, 4, 2); __PYX_ERR(0, 717, __pyx_L3_error)
15634  }
15635  CYTHON_FALLTHROUGH;
15636  case 3:
15637  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flux)) != 0)) kw_args--;
15638  else {
15639  __Pyx_RaiseArgtupleInvalid("calculateNormalFlux", 1, 4, 4, 3); __PYX_ERR(0, 717, __pyx_L3_error)
15640  }
15641  }
15642  if (unlikely(kw_args > 0)) {
15643  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calculateNormalFlux") < 0)) __PYX_ERR(0, 717, __pyx_L3_error)
15644  }
15645  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
15646  goto __pyx_L5_argtuple_error;
15647  } else {
15648  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15649  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15650  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
15651  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
15652  }
15653  __pyx_v_v = ((PyArrayObject *)values[0]);
15654  __pyx_v_n = ((PyArrayObject *)values[1]);
15655  __pyx_v_dS = ((PyArrayObject *)values[2]);
15656  __pyx_v_flux = ((PyArrayObject *)values[3]);
15657  }
15658  goto __pyx_L4_argument_unpacking_done;
15659  __pyx_L5_argtuple_error:;
15660  __Pyx_RaiseArgtupleInvalid("calculateNormalFlux", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 717, __pyx_L3_error)
15661  __pyx_L3_error:;
15662  __Pyx_AddTraceback("subsurfaceTransportFunctions.calculateNormalFlux", __pyx_clineno, __pyx_lineno, __pyx_filename);
15663  __Pyx_RefNannyFinishContext();
15664  return NULL;
15665  __pyx_L4_argument_unpacking_done:;
15666  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 717, __pyx_L1_error)
15667  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_n), __pyx_ptype_5numpy_ndarray, 1, "n", 0))) __PYX_ERR(0, 718, __pyx_L1_error)
15668  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dS), __pyx_ptype_5numpy_ndarray, 1, "dS", 0))) __PYX_ERR(0, 719, __pyx_L1_error)
15669  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_flux), __pyx_ptype_5numpy_ndarray, 1, "flux", 0))) __PYX_ERR(0, 720, __pyx_L1_error)
15670  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_40calculateNormalFlux(__pyx_self, __pyx_v_v, __pyx_v_n, __pyx_v_dS, __pyx_v_flux);
15671 
15672  /* function exit code */
15673  goto __pyx_L0;
15674  __pyx_L1_error:;
15675  __pyx_r = NULL;
15676  __pyx_L0:;
15677  __Pyx_RefNannyFinishContext();
15678  return __pyx_r;
15679 }
15680 
15681 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_40calculateNormalFlux(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_v, PyArrayObject *__pyx_v_n, PyArrayObject *__pyx_v_dS, PyArrayObject *__pyx_v_flux) {
15682  int __pyx_v_eN;
15683  int __pyx_v_ebN;
15684  int __pyx_v_kb;
15685  double __pyx_v_integral;
15686  npy_intp __pyx_v_I;
15687  __Pyx_LocalBuf_ND __pyx_pybuffernd_dS;
15688  __Pyx_Buffer __pyx_pybuffer_dS;
15689  __Pyx_LocalBuf_ND __pyx_pybuffernd_flux;
15690  __Pyx_Buffer __pyx_pybuffer_flux;
15691  __Pyx_LocalBuf_ND __pyx_pybuffernd_n;
15692  __Pyx_Buffer __pyx_pybuffer_n;
15693  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
15694  __Pyx_Buffer __pyx_pybuffer_v;
15695  PyObject *__pyx_r = NULL;
15696  __Pyx_RefNannyDeclarations
15697  npy_intp __pyx_t_1;
15698  npy_intp __pyx_t_2;
15699  int __pyx_t_3;
15700  npy_intp __pyx_t_4;
15701  npy_intp __pyx_t_5;
15702  int __pyx_t_6;
15703  npy_intp __pyx_t_7;
15704  npy_intp __pyx_t_8;
15705  int __pyx_t_9;
15706  npy_intp __pyx_t_10;
15707  npy_intp __pyx_t_11;
15708  npy_intp __pyx_t_12;
15709  Py_ssize_t __pyx_t_13;
15710  Py_ssize_t __pyx_t_14;
15711  Py_ssize_t __pyx_t_15;
15712  Py_ssize_t __pyx_t_16;
15713  int __pyx_t_17;
15714  Py_ssize_t __pyx_t_18;
15715  Py_ssize_t __pyx_t_19;
15716  Py_ssize_t __pyx_t_20;
15717  Py_ssize_t __pyx_t_21;
15718  Py_ssize_t __pyx_t_22;
15719  Py_ssize_t __pyx_t_23;
15720  Py_ssize_t __pyx_t_24;
15721  int __pyx_lineno = 0;
15722  const char *__pyx_filename = NULL;
15723  int __pyx_clineno = 0;
15724  __Pyx_RefNannySetupContext("calculateNormalFlux", 0);
15725  __pyx_pybuffer_v.pybuffer.buf = NULL;
15726  __pyx_pybuffer_v.refcount = 0;
15727  __pyx_pybuffernd_v.data = NULL;
15728  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
15729  __pyx_pybuffer_n.pybuffer.buf = NULL;
15730  __pyx_pybuffer_n.refcount = 0;
15731  __pyx_pybuffernd_n.data = NULL;
15732  __pyx_pybuffernd_n.rcbuffer = &__pyx_pybuffer_n;
15733  __pyx_pybuffer_dS.pybuffer.buf = NULL;
15734  __pyx_pybuffer_dS.refcount = 0;
15735  __pyx_pybuffernd_dS.data = NULL;
15736  __pyx_pybuffernd_dS.rcbuffer = &__pyx_pybuffer_dS;
15737  __pyx_pybuffer_flux.pybuffer.buf = NULL;
15738  __pyx_pybuffer_flux.refcount = 0;
15739  __pyx_pybuffernd_flux.data = NULL;
15740  __pyx_pybuffernd_flux.rcbuffer = &__pyx_pybuffer_flux;
15741  {
15742  __Pyx_BufFmt_StackElem __pyx_stack[1];
15743  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 717, __pyx_L1_error)
15744  }
15745  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_v.diminfo[3].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_v.diminfo[3].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[3];
15746  {
15747  __Pyx_BufFmt_StackElem __pyx_stack[1];
15748  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_n.rcbuffer->pybuffer, (PyObject*)__pyx_v_n, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 717, __pyx_L1_error)
15749  }
15750  __pyx_pybuffernd_n.diminfo[0].strides = __pyx_pybuffernd_n.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_n.diminfo[0].shape = __pyx_pybuffernd_n.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_n.diminfo[1].strides = __pyx_pybuffernd_n.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_n.diminfo[1].shape = __pyx_pybuffernd_n.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_n.diminfo[2].strides = __pyx_pybuffernd_n.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_n.diminfo[2].shape = __pyx_pybuffernd_n.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_n.diminfo[3].strides = __pyx_pybuffernd_n.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_n.diminfo[3].shape = __pyx_pybuffernd_n.rcbuffer->pybuffer.shape[3];
15751  {
15752  __Pyx_BufFmt_StackElem __pyx_stack[1];
15753  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dS.rcbuffer->pybuffer, (PyObject*)__pyx_v_dS, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 717, __pyx_L1_error)
15754  }
15755  __pyx_pybuffernd_dS.diminfo[0].strides = __pyx_pybuffernd_dS.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dS.diminfo[0].shape = __pyx_pybuffernd_dS.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dS.diminfo[1].strides = __pyx_pybuffernd_dS.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dS.diminfo[1].shape = __pyx_pybuffernd_dS.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_dS.diminfo[2].strides = __pyx_pybuffernd_dS.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_dS.diminfo[2].shape = __pyx_pybuffernd_dS.rcbuffer->pybuffer.shape[2];
15756  {
15757  __Pyx_BufFmt_StackElem __pyx_stack[1];
15758  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_flux.rcbuffer->pybuffer, (PyObject*)__pyx_v_flux, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 717, __pyx_L1_error)
15759  }
15760  __pyx_pybuffernd_flux.diminfo[0].strides = __pyx_pybuffernd_flux.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_flux.diminfo[0].shape = __pyx_pybuffernd_flux.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_flux.diminfo[1].strides = __pyx_pybuffernd_flux.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_flux.diminfo[1].shape = __pyx_pybuffernd_flux.rcbuffer->pybuffer.shape[1];
15761 
15762  /* "subsurfaceTransportFunctions.pyx":724
15763  * cdef int eN,ebN,kb
15764  * cdef double integral
15765  * for eN in range(n.shape[0]): # <<<<<<<<<<<<<<
15766  * for ebN in range(n.shape[1]):
15767  * integral = 0.0
15768  */
15769  __pyx_t_1 = (__pyx_v_n->dimensions[0]);
15770  __pyx_t_2 = __pyx_t_1;
15771  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
15772  __pyx_v_eN = __pyx_t_3;
15773 
15774  /* "subsurfaceTransportFunctions.pyx":725
15775  * cdef double integral
15776  * for eN in range(n.shape[0]):
15777  * for ebN in range(n.shape[1]): # <<<<<<<<<<<<<<
15778  * integral = 0.0
15779  * for kb in range(n.shape[2]):
15780  */
15781  __pyx_t_4 = (__pyx_v_n->dimensions[1]);
15782  __pyx_t_5 = __pyx_t_4;
15783  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
15784  __pyx_v_ebN = __pyx_t_6;
15785 
15786  /* "subsurfaceTransportFunctions.pyx":726
15787  * for eN in range(n.shape[0]):
15788  * for ebN in range(n.shape[1]):
15789  * integral = 0.0 # <<<<<<<<<<<<<<
15790  * for kb in range(n.shape[2]):
15791  * for I in range(n.shape[3]):
15792  */
15793  __pyx_v_integral = 0.0;
15794 
15795  /* "subsurfaceTransportFunctions.pyx":727
15796  * for ebN in range(n.shape[1]):
15797  * integral = 0.0
15798  * for kb in range(n.shape[2]): # <<<<<<<<<<<<<<
15799  * for I in range(n.shape[3]):
15800  * integral += v[eN,ebN,kb,I]*n[eN,ebN,kb,I]*dS[eN,ebN,kb]
15801  */
15802  __pyx_t_7 = (__pyx_v_n->dimensions[2]);
15803  __pyx_t_8 = __pyx_t_7;
15804  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
15805  __pyx_v_kb = __pyx_t_9;
15806 
15807  /* "subsurfaceTransportFunctions.pyx":728
15808  * integral = 0.0
15809  * for kb in range(n.shape[2]):
15810  * for I in range(n.shape[3]): # <<<<<<<<<<<<<<
15811  * integral += v[eN,ebN,kb,I]*n[eN,ebN,kb,I]*dS[eN,ebN,kb]
15812  * flux[eN,ebN] = integral
15813  */
15814  __pyx_t_10 = (__pyx_v_n->dimensions[3]);
15815  __pyx_t_11 = __pyx_t_10;
15816  for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
15817  __pyx_v_I = __pyx_t_12;
15818 
15819  /* "subsurfaceTransportFunctions.pyx":729
15820  * for kb in range(n.shape[2]):
15821  * for I in range(n.shape[3]):
15822  * integral += v[eN,ebN,kb,I]*n[eN,ebN,kb,I]*dS[eN,ebN,kb] # <<<<<<<<<<<<<<
15823  * flux[eN,ebN] = integral
15824  *
15825  */
15826  __pyx_t_13 = __pyx_v_eN;
15827  __pyx_t_14 = __pyx_v_ebN;
15828  __pyx_t_15 = __pyx_v_kb;
15829  __pyx_t_16 = __pyx_v_I;
15830  __pyx_t_17 = -1;
15831  if (__pyx_t_13 < 0) {
15832  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[0].shape;
15833  if (unlikely(__pyx_t_13 < 0)) __pyx_t_17 = 0;
15834  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_17 = 0;
15835  if (__pyx_t_14 < 0) {
15836  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[1].shape;
15837  if (unlikely(__pyx_t_14 < 0)) __pyx_t_17 = 1;
15838  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_17 = 1;
15839  if (__pyx_t_15 < 0) {
15840  __pyx_t_15 += __pyx_pybuffernd_v.diminfo[2].shape;
15841  if (unlikely(__pyx_t_15 < 0)) __pyx_t_17 = 2;
15842  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_17 = 2;
15843  if (__pyx_t_16 < 0) {
15844  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[3].shape;
15845  if (unlikely(__pyx_t_16 < 0)) __pyx_t_17 = 3;
15846  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_17 = 3;
15847  if (unlikely(__pyx_t_17 != -1)) {
15848  __Pyx_RaiseBufferIndexError(__pyx_t_17);
15849  __PYX_ERR(0, 729, __pyx_L1_error)
15850  }
15851  __pyx_t_18 = __pyx_v_eN;
15852  __pyx_t_19 = __pyx_v_ebN;
15853  __pyx_t_20 = __pyx_v_kb;
15854  __pyx_t_21 = __pyx_v_I;
15855  __pyx_t_17 = -1;
15856  if (__pyx_t_18 < 0) {
15857  __pyx_t_18 += __pyx_pybuffernd_n.diminfo[0].shape;
15858  if (unlikely(__pyx_t_18 < 0)) __pyx_t_17 = 0;
15859  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_n.diminfo[0].shape)) __pyx_t_17 = 0;
15860  if (__pyx_t_19 < 0) {
15861  __pyx_t_19 += __pyx_pybuffernd_n.diminfo[1].shape;
15862  if (unlikely(__pyx_t_19 < 0)) __pyx_t_17 = 1;
15863  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_n.diminfo[1].shape)) __pyx_t_17 = 1;
15864  if (__pyx_t_20 < 0) {
15865  __pyx_t_20 += __pyx_pybuffernd_n.diminfo[2].shape;
15866  if (unlikely(__pyx_t_20 < 0)) __pyx_t_17 = 2;
15867  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_n.diminfo[2].shape)) __pyx_t_17 = 2;
15868  if (__pyx_t_21 < 0) {
15869  __pyx_t_21 += __pyx_pybuffernd_n.diminfo[3].shape;
15870  if (unlikely(__pyx_t_21 < 0)) __pyx_t_17 = 3;
15871  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_n.diminfo[3].shape)) __pyx_t_17 = 3;
15872  if (unlikely(__pyx_t_17 != -1)) {
15873  __Pyx_RaiseBufferIndexError(__pyx_t_17);
15874  __PYX_ERR(0, 729, __pyx_L1_error)
15875  }
15876  __pyx_t_22 = __pyx_v_eN;
15877  __pyx_t_23 = __pyx_v_ebN;
15878  __pyx_t_24 = __pyx_v_kb;
15879  __pyx_t_17 = -1;
15880  if (__pyx_t_22 < 0) {
15881  __pyx_t_22 += __pyx_pybuffernd_dS.diminfo[0].shape;
15882  if (unlikely(__pyx_t_22 < 0)) __pyx_t_17 = 0;
15883  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_dS.diminfo[0].shape)) __pyx_t_17 = 0;
15884  if (__pyx_t_23 < 0) {
15885  __pyx_t_23 += __pyx_pybuffernd_dS.diminfo[1].shape;
15886  if (unlikely(__pyx_t_23 < 0)) __pyx_t_17 = 1;
15887  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_dS.diminfo[1].shape)) __pyx_t_17 = 1;
15888  if (__pyx_t_24 < 0) {
15889  __pyx_t_24 += __pyx_pybuffernd_dS.diminfo[2].shape;
15890  if (unlikely(__pyx_t_24 < 0)) __pyx_t_17 = 2;
15891  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_dS.diminfo[2].shape)) __pyx_t_17 = 2;
15892  if (unlikely(__pyx_t_17 != -1)) {
15893  __Pyx_RaiseBufferIndexError(__pyx_t_17);
15894  __PYX_ERR(0, 729, __pyx_L1_error)
15895  }
15896  __pyx_v_integral = (__pyx_v_integral + (((*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_15, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_16, __pyx_pybuffernd_v.diminfo[3].strides)) * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_n.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_n.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_n.diminfo[1].strides, __pyx_t_20, __pyx_pybuffernd_n.diminfo[2].strides, __pyx_t_21, __pyx_pybuffernd_n.diminfo[3].strides))) * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dS.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_dS.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_dS.diminfo[1].strides, __pyx_t_24, __pyx_pybuffernd_dS.diminfo[2].strides))));
15897  }
15898  }
15899 
15900  /* "subsurfaceTransportFunctions.pyx":730
15901  * for I in range(n.shape[3]):
15902  * integral += v[eN,ebN,kb,I]*n[eN,ebN,kb,I]*dS[eN,ebN,kb]
15903  * flux[eN,ebN] = integral # <<<<<<<<<<<<<<
15904  *
15905  * def computeSimpleCharacteristicVelocityFromElementVelocity(numpy.ndarray[DTYPE_t,ndim=3] df,
15906  */
15907  __pyx_t_24 = __pyx_v_eN;
15908  __pyx_t_23 = __pyx_v_ebN;
15909  __pyx_t_9 = -1;
15910  if (__pyx_t_24 < 0) {
15911  __pyx_t_24 += __pyx_pybuffernd_flux.diminfo[0].shape;
15912  if (unlikely(__pyx_t_24 < 0)) __pyx_t_9 = 0;
15913  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_flux.diminfo[0].shape)) __pyx_t_9 = 0;
15914  if (__pyx_t_23 < 0) {
15915  __pyx_t_23 += __pyx_pybuffernd_flux.diminfo[1].shape;
15916  if (unlikely(__pyx_t_23 < 0)) __pyx_t_9 = 1;
15917  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_flux.diminfo[1].shape)) __pyx_t_9 = 1;
15918  if (unlikely(__pyx_t_9 != -1)) {
15919  __Pyx_RaiseBufferIndexError(__pyx_t_9);
15920  __PYX_ERR(0, 730, __pyx_L1_error)
15921  }
15922  *__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_flux.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_flux.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_flux.diminfo[1].strides) = __pyx_v_integral;
15923  }
15924  }
15925 
15926  /* "subsurfaceTransportFunctions.pyx":717
15927  * #ELLAM
15928  * ########################################################################
15929  * def calculateNormalFlux(numpy.ndarray[DTYPE_t,ndim=4] v, # <<<<<<<<<<<<<<
15930  * numpy.ndarray[DTYPE_t,ndim=4] n,
15931  * numpy.ndarray[DTYPE_t,ndim=3] dS,
15932  */
15933 
15934  /* function exit code */
15935  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
15936  goto __pyx_L0;
15937  __pyx_L1_error:;
15938  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
15939  __Pyx_PyThreadState_declare
15940  __Pyx_PyThreadState_assign
15941  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
15942  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dS.rcbuffer->pybuffer);
15943  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_flux.rcbuffer->pybuffer);
15944  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_n.rcbuffer->pybuffer);
15945  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
15946  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
15947  __Pyx_AddTraceback("subsurfaceTransportFunctions.calculateNormalFlux", __pyx_clineno, __pyx_lineno, __pyx_filename);
15948  __pyx_r = NULL;
15949  goto __pyx_L2;
15950  __pyx_L0:;
15951  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dS.rcbuffer->pybuffer);
15952  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_flux.rcbuffer->pybuffer);
15953  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_n.rcbuffer->pybuffer);
15954  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
15955  __pyx_L2:;
15956  __Pyx_XGIVEREF(__pyx_r);
15957  __Pyx_RefNannyFinishContext();
15958  return __pyx_r;
15959 }
15960 
15961 /* "subsurfaceTransportFunctions.pyx":732
15962  * flux[eN,ebN] = integral
15963  *
15964  * def computeSimpleCharacteristicVelocityFromElementVelocity(numpy.ndarray[DTYPE_t,ndim=3] df, # <<<<<<<<<<<<<<
15965  * numpy.ndarray[DTYPE_t,ndim=3] characteristic_velocity,
15966  * numpy.ndarray[DTYPE_t,ndim=2] dm,
15967  */
15968 
15969 /* Python wrapper */
15970 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_43computeSimpleCharacteristicVelocityFromElementVelocity(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
15971 static char __pyx_doc_28subsurfaceTransportFunctions_42computeSimpleCharacteristicVelocityFromElementVelocity[] = "\n simple approximation for \\lambda = df/\010ar{dm} using \010ar{dm} = \014rac{1}{\\Omega_e} \\int_{\\Omega_e} dm dV\n ";
15972 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_43computeSimpleCharacteristicVelocityFromElementVelocity = {"computeSimpleCharacteristicVelocityFromElementVelocity", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_43computeSimpleCharacteristicVelocityFromElementVelocity, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_42computeSimpleCharacteristicVelocityFromElementVelocity};
15973 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_43computeSimpleCharacteristicVelocityFromElementVelocity(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
15974  PyArrayObject *__pyx_v_df = 0;
15975  PyArrayObject *__pyx_v_characteristic_velocity = 0;
15976  PyArrayObject *__pyx_v_dm = 0;
15977  PyArrayObject *__pyx_v_dV = 0;
15978  int __pyx_lineno = 0;
15979  const char *__pyx_filename = NULL;
15980  int __pyx_clineno = 0;
15981  PyObject *__pyx_r = 0;
15982  __Pyx_RefNannyDeclarations
15983  __Pyx_RefNannySetupContext("computeSimpleCharacteristicVelocityFromElementVelocity (wrapper)", 0);
15984  {
15985  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_df,&__pyx_n_s_characteristic_velocity,&__pyx_n_s_dm,&__pyx_n_s_dV,0};
15986  PyObject* values[4] = {0,0,0,0};
15987  if (unlikely(__pyx_kwds)) {
15988  Py_ssize_t kw_args;
15989  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
15990  switch (pos_args) {
15991  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
15992  CYTHON_FALLTHROUGH;
15993  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
15994  CYTHON_FALLTHROUGH;
15995  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
15996  CYTHON_FALLTHROUGH;
15997  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
15998  CYTHON_FALLTHROUGH;
15999  case 0: break;
16000  default: goto __pyx_L5_argtuple_error;
16001  }
16002  kw_args = PyDict_Size(__pyx_kwds);
16003  switch (pos_args) {
16004  case 0:
16005  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_df)) != 0)) kw_args--;
16006  else goto __pyx_L5_argtuple_error;
16007  CYTHON_FALLTHROUGH;
16008  case 1:
16009  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_characteristic_velocity)) != 0)) kw_args--;
16010  else {
16011  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromElementVelocity", 1, 4, 4, 1); __PYX_ERR(0, 732, __pyx_L3_error)
16012  }
16013  CYTHON_FALLTHROUGH;
16014  case 2:
16015  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dm)) != 0)) kw_args--;
16016  else {
16017  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromElementVelocity", 1, 4, 4, 2); __PYX_ERR(0, 732, __pyx_L3_error)
16018  }
16019  CYTHON_FALLTHROUGH;
16020  case 3:
16021  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dV)) != 0)) kw_args--;
16022  else {
16023  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromElementVelocity", 1, 4, 4, 3); __PYX_ERR(0, 732, __pyx_L3_error)
16024  }
16025  }
16026  if (unlikely(kw_args > 0)) {
16027  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "computeSimpleCharacteristicVelocityFromElementVelocity") < 0)) __PYX_ERR(0, 732, __pyx_L3_error)
16028  }
16029  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
16030  goto __pyx_L5_argtuple_error;
16031  } else {
16032  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
16033  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
16034  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
16035  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
16036  }
16037  __pyx_v_df = ((PyArrayObject *)values[0]);
16038  __pyx_v_characteristic_velocity = ((PyArrayObject *)values[1]);
16039  __pyx_v_dm = ((PyArrayObject *)values[2]);
16040  __pyx_v_dV = ((PyArrayObject *)values[3]);
16041  }
16042  goto __pyx_L4_argument_unpacking_done;
16043  __pyx_L5_argtuple_error:;
16044  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromElementVelocity", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 732, __pyx_L3_error)
16045  __pyx_L3_error:;
16046  __Pyx_AddTraceback("subsurfaceTransportFunctions.computeSimpleCharacteristicVelocityFromElementVelocity", __pyx_clineno, __pyx_lineno, __pyx_filename);
16047  __Pyx_RefNannyFinishContext();
16048  return NULL;
16049  __pyx_L4_argument_unpacking_done:;
16050  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_df), __pyx_ptype_5numpy_ndarray, 1, "df", 0))) __PYX_ERR(0, 732, __pyx_L1_error)
16051  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_characteristic_velocity), __pyx_ptype_5numpy_ndarray, 1, "characteristic_velocity", 0))) __PYX_ERR(0, 733, __pyx_L1_error)
16052  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dm), __pyx_ptype_5numpy_ndarray, 1, "dm", 0))) __PYX_ERR(0, 734, __pyx_L1_error)
16053  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dV), __pyx_ptype_5numpy_ndarray, 1, "dV", 0))) __PYX_ERR(0, 735, __pyx_L1_error)
16054  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_42computeSimpleCharacteristicVelocityFromElementVelocity(__pyx_self, __pyx_v_df, __pyx_v_characteristic_velocity, __pyx_v_dm, __pyx_v_dV);
16055 
16056  /* function exit code */
16057  goto __pyx_L0;
16058  __pyx_L1_error:;
16059  __pyx_r = NULL;
16060  __pyx_L0:;
16061  __Pyx_RefNannyFinishContext();
16062  return __pyx_r;
16063 }
16064 
16065 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_42computeSimpleCharacteristicVelocityFromElementVelocity(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_df, PyArrayObject *__pyx_v_characteristic_velocity, PyArrayObject *__pyx_v_dm, PyArrayObject *__pyx_v_dV) {
16066  int __pyx_v_eN;
16067  int __pyx_v_k;
16068  int __pyx_v_I;
16069  double __pyx_v_omega_e;
16070  double __pyx_v_vol_e;
16071  __Pyx_LocalBuf_ND __pyx_pybuffernd_characteristic_velocity;
16072  __Pyx_Buffer __pyx_pybuffer_characteristic_velocity;
16073  __Pyx_LocalBuf_ND __pyx_pybuffernd_dV;
16074  __Pyx_Buffer __pyx_pybuffer_dV;
16075  __Pyx_LocalBuf_ND __pyx_pybuffernd_df;
16076  __Pyx_Buffer __pyx_pybuffer_df;
16077  __Pyx_LocalBuf_ND __pyx_pybuffernd_dm;
16078  __Pyx_Buffer __pyx_pybuffer_dm;
16079  PyObject *__pyx_r = NULL;
16080  __Pyx_RefNannyDeclarations
16081  npy_intp __pyx_t_1;
16082  npy_intp __pyx_t_2;
16083  int __pyx_t_3;
16084  npy_intp __pyx_t_4;
16085  npy_intp __pyx_t_5;
16086  int __pyx_t_6;
16087  Py_ssize_t __pyx_t_7;
16088  Py_ssize_t __pyx_t_8;
16089  int __pyx_t_9;
16090  Py_ssize_t __pyx_t_10;
16091  Py_ssize_t __pyx_t_11;
16092  npy_intp __pyx_t_12;
16093  npy_intp __pyx_t_13;
16094  int __pyx_t_14;
16095  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_15;
16096  double __pyx_t_16;
16097  int __pyx_lineno = 0;
16098  const char *__pyx_filename = NULL;
16099  int __pyx_clineno = 0;
16100  __Pyx_RefNannySetupContext("computeSimpleCharacteristicVelocityFromElementVelocity", 0);
16101  __pyx_pybuffer_df.pybuffer.buf = NULL;
16102  __pyx_pybuffer_df.refcount = 0;
16103  __pyx_pybuffernd_df.data = NULL;
16104  __pyx_pybuffernd_df.rcbuffer = &__pyx_pybuffer_df;
16105  __pyx_pybuffer_characteristic_velocity.pybuffer.buf = NULL;
16106  __pyx_pybuffer_characteristic_velocity.refcount = 0;
16107  __pyx_pybuffernd_characteristic_velocity.data = NULL;
16108  __pyx_pybuffernd_characteristic_velocity.rcbuffer = &__pyx_pybuffer_characteristic_velocity;
16109  __pyx_pybuffer_dm.pybuffer.buf = NULL;
16110  __pyx_pybuffer_dm.refcount = 0;
16111  __pyx_pybuffernd_dm.data = NULL;
16112  __pyx_pybuffernd_dm.rcbuffer = &__pyx_pybuffer_dm;
16113  __pyx_pybuffer_dV.pybuffer.buf = NULL;
16114  __pyx_pybuffer_dV.refcount = 0;
16115  __pyx_pybuffernd_dV.data = NULL;
16116  __pyx_pybuffernd_dV.rcbuffer = &__pyx_pybuffer_dV;
16117  {
16118  __Pyx_BufFmt_StackElem __pyx_stack[1];
16119  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_df.rcbuffer->pybuffer, (PyObject*)__pyx_v_df, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 732, __pyx_L1_error)
16120  }
16121  __pyx_pybuffernd_df.diminfo[0].strides = __pyx_pybuffernd_df.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_df.diminfo[0].shape = __pyx_pybuffernd_df.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_df.diminfo[1].strides = __pyx_pybuffernd_df.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_df.diminfo[1].shape = __pyx_pybuffernd_df.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_df.diminfo[2].strides = __pyx_pybuffernd_df.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_df.diminfo[2].shape = __pyx_pybuffernd_df.rcbuffer->pybuffer.shape[2];
16122  {
16123  __Pyx_BufFmt_StackElem __pyx_stack[1];
16124  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer, (PyObject*)__pyx_v_characteristic_velocity, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 732, __pyx_L1_error)
16125  }
16126  __pyx_pybuffernd_characteristic_velocity.diminfo[0].strides = __pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_characteristic_velocity.diminfo[0].shape = __pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_characteristic_velocity.diminfo[1].strides = __pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_characteristic_velocity.diminfo[1].shape = __pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_characteristic_velocity.diminfo[2].strides = __pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_characteristic_velocity.diminfo[2].shape = __pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer.shape[2];
16127  {
16128  __Pyx_BufFmt_StackElem __pyx_stack[1];
16129  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dm.rcbuffer->pybuffer, (PyObject*)__pyx_v_dm, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 732, __pyx_L1_error)
16130  }
16131  __pyx_pybuffernd_dm.diminfo[0].strides = __pyx_pybuffernd_dm.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dm.diminfo[0].shape = __pyx_pybuffernd_dm.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dm.diminfo[1].strides = __pyx_pybuffernd_dm.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dm.diminfo[1].shape = __pyx_pybuffernd_dm.rcbuffer->pybuffer.shape[1];
16132  {
16133  __Pyx_BufFmt_StackElem __pyx_stack[1];
16134  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dV.rcbuffer->pybuffer, (PyObject*)__pyx_v_dV, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 732, __pyx_L1_error)
16135  }
16136  __pyx_pybuffernd_dV.diminfo[0].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dV.diminfo[0].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dV.diminfo[1].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dV.diminfo[1].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[1];
16137 
16138  /* "subsurfaceTransportFunctions.pyx":743
16139  * cdef double omega_e, vol_e
16140  *
16141  * for eN in range(dm.shape[0]): # <<<<<<<<<<<<<<
16142  * omega_e = 0.0
16143  * vol_e = 0.0
16144  */
16145  __pyx_t_1 = (__pyx_v_dm->dimensions[0]);
16146  __pyx_t_2 = __pyx_t_1;
16147  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
16148  __pyx_v_eN = __pyx_t_3;
16149 
16150  /* "subsurfaceTransportFunctions.pyx":744
16151  *
16152  * for eN in range(dm.shape[0]):
16153  * omega_e = 0.0 # <<<<<<<<<<<<<<
16154  * vol_e = 0.0
16155  * for k in range(dm.shape[1]):
16156  */
16157  __pyx_v_omega_e = 0.0;
16158 
16159  /* "subsurfaceTransportFunctions.pyx":745
16160  * for eN in range(dm.shape[0]):
16161  * omega_e = 0.0
16162  * vol_e = 0.0 # <<<<<<<<<<<<<<
16163  * for k in range(dm.shape[1]):
16164  * vol_e += dV[eN,k]
16165  */
16166  __pyx_v_vol_e = 0.0;
16167 
16168  /* "subsurfaceTransportFunctions.pyx":746
16169  * omega_e = 0.0
16170  * vol_e = 0.0
16171  * for k in range(dm.shape[1]): # <<<<<<<<<<<<<<
16172  * vol_e += dV[eN,k]
16173  * omega_e += dV[eN,k]*dm[eN,k]
16174  */
16175  __pyx_t_4 = (__pyx_v_dm->dimensions[1]);
16176  __pyx_t_5 = __pyx_t_4;
16177  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
16178  __pyx_v_k = __pyx_t_6;
16179 
16180  /* "subsurfaceTransportFunctions.pyx":747
16181  * vol_e = 0.0
16182  * for k in range(dm.shape[1]):
16183  * vol_e += dV[eN,k] # <<<<<<<<<<<<<<
16184  * omega_e += dV[eN,k]*dm[eN,k]
16185  * for k in range(df.shape[1]):
16186  */
16187  __pyx_t_7 = __pyx_v_eN;
16188  __pyx_t_8 = __pyx_v_k;
16189  __pyx_t_9 = -1;
16190  if (__pyx_t_7 < 0) {
16191  __pyx_t_7 += __pyx_pybuffernd_dV.diminfo[0].shape;
16192  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
16193  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_9 = 0;
16194  if (__pyx_t_8 < 0) {
16195  __pyx_t_8 += __pyx_pybuffernd_dV.diminfo[1].shape;
16196  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
16197  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_9 = 1;
16198  if (unlikely(__pyx_t_9 != -1)) {
16199  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16200  __PYX_ERR(0, 747, __pyx_L1_error)
16201  }
16202  __pyx_v_vol_e = (__pyx_v_vol_e + (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_dV.diminfo[1].strides)));
16203 
16204  /* "subsurfaceTransportFunctions.pyx":748
16205  * for k in range(dm.shape[1]):
16206  * vol_e += dV[eN,k]
16207  * omega_e += dV[eN,k]*dm[eN,k] # <<<<<<<<<<<<<<
16208  * for k in range(df.shape[1]):
16209  * for I in range(df.shape[2]):
16210  */
16211  __pyx_t_8 = __pyx_v_eN;
16212  __pyx_t_7 = __pyx_v_k;
16213  __pyx_t_9 = -1;
16214  if (__pyx_t_8 < 0) {
16215  __pyx_t_8 += __pyx_pybuffernd_dV.diminfo[0].shape;
16216  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0;
16217  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_9 = 0;
16218  if (__pyx_t_7 < 0) {
16219  __pyx_t_7 += __pyx_pybuffernd_dV.diminfo[1].shape;
16220  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 1;
16221  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_9 = 1;
16222  if (unlikely(__pyx_t_9 != -1)) {
16223  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16224  __PYX_ERR(0, 748, __pyx_L1_error)
16225  }
16226  __pyx_t_10 = __pyx_v_eN;
16227  __pyx_t_11 = __pyx_v_k;
16228  __pyx_t_9 = -1;
16229  if (__pyx_t_10 < 0) {
16230  __pyx_t_10 += __pyx_pybuffernd_dm.diminfo[0].shape;
16231  if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0;
16232  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_dm.diminfo[0].shape)) __pyx_t_9 = 0;
16233  if (__pyx_t_11 < 0) {
16234  __pyx_t_11 += __pyx_pybuffernd_dm.diminfo[1].shape;
16235  if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 1;
16236  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_dm.diminfo[1].shape)) __pyx_t_9 = 1;
16237  if (unlikely(__pyx_t_9 != -1)) {
16238  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16239  __PYX_ERR(0, 748, __pyx_L1_error)
16240  }
16241  __pyx_v_omega_e = (__pyx_v_omega_e + ((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_dV.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dm.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_dm.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_dm.diminfo[1].strides))));
16242  }
16243 
16244  /* "subsurfaceTransportFunctions.pyx":749
16245  * vol_e += dV[eN,k]
16246  * omega_e += dV[eN,k]*dm[eN,k]
16247  * for k in range(df.shape[1]): # <<<<<<<<<<<<<<
16248  * for I in range(df.shape[2]):
16249  * characteristic_velocity[eN,k,I] = df[eN,k,I]*vol_e/(omega_e+1.0e-12)
16250  */
16251  __pyx_t_4 = (__pyx_v_df->dimensions[1]);
16252  __pyx_t_5 = __pyx_t_4;
16253  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
16254  __pyx_v_k = __pyx_t_6;
16255 
16256  /* "subsurfaceTransportFunctions.pyx":750
16257  * omega_e += dV[eN,k]*dm[eN,k]
16258  * for k in range(df.shape[1]):
16259  * for I in range(df.shape[2]): # <<<<<<<<<<<<<<
16260  * characteristic_velocity[eN,k,I] = df[eN,k,I]*vol_e/(omega_e+1.0e-12)
16261  *
16262  */
16263  __pyx_t_12 = (__pyx_v_df->dimensions[2]);
16264  __pyx_t_13 = __pyx_t_12;
16265  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_13; __pyx_t_9+=1) {
16266  __pyx_v_I = __pyx_t_9;
16267 
16268  /* "subsurfaceTransportFunctions.pyx":751
16269  * for k in range(df.shape[1]):
16270  * for I in range(df.shape[2]):
16271  * characteristic_velocity[eN,k,I] = df[eN,k,I]*vol_e/(omega_e+1.0e-12) # <<<<<<<<<<<<<<
16272  *
16273  * def computeSimpleCharacteristicVelocityFromVelocityDOFs(numpy.ndarray[DTYPE_t,ndim=1] df_dofs,
16274  */
16275  __pyx_t_11 = __pyx_v_eN;
16276  __pyx_t_10 = __pyx_v_k;
16277  __pyx_t_7 = __pyx_v_I;
16278  __pyx_t_14 = -1;
16279  if (__pyx_t_11 < 0) {
16280  __pyx_t_11 += __pyx_pybuffernd_df.diminfo[0].shape;
16281  if (unlikely(__pyx_t_11 < 0)) __pyx_t_14 = 0;
16282  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_df.diminfo[0].shape)) __pyx_t_14 = 0;
16283  if (__pyx_t_10 < 0) {
16284  __pyx_t_10 += __pyx_pybuffernd_df.diminfo[1].shape;
16285  if (unlikely(__pyx_t_10 < 0)) __pyx_t_14 = 1;
16286  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_df.diminfo[1].shape)) __pyx_t_14 = 1;
16287  if (__pyx_t_7 < 0) {
16288  __pyx_t_7 += __pyx_pybuffernd_df.diminfo[2].shape;
16289  if (unlikely(__pyx_t_7 < 0)) __pyx_t_14 = 2;
16290  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_df.diminfo[2].shape)) __pyx_t_14 = 2;
16291  if (unlikely(__pyx_t_14 != -1)) {
16292  __Pyx_RaiseBufferIndexError(__pyx_t_14);
16293  __PYX_ERR(0, 751, __pyx_L1_error)
16294  }
16295  __pyx_t_15 = ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_df.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_df.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_df.diminfo[1].strides, __pyx_t_7, __pyx_pybuffernd_df.diminfo[2].strides)) * __pyx_v_vol_e);
16296  __pyx_t_16 = (__pyx_v_omega_e + 1.0e-12);
16297  if (unlikely(__pyx_t_16 == 0)) {
16298  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
16299  __PYX_ERR(0, 751, __pyx_L1_error)
16300  }
16301  __pyx_t_7 = __pyx_v_eN;
16302  __pyx_t_10 = __pyx_v_k;
16303  __pyx_t_11 = __pyx_v_I;
16304  __pyx_t_14 = -1;
16305  if (__pyx_t_7 < 0) {
16306  __pyx_t_7 += __pyx_pybuffernd_characteristic_velocity.diminfo[0].shape;
16307  if (unlikely(__pyx_t_7 < 0)) __pyx_t_14 = 0;
16308  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_characteristic_velocity.diminfo[0].shape)) __pyx_t_14 = 0;
16309  if (__pyx_t_10 < 0) {
16310  __pyx_t_10 += __pyx_pybuffernd_characteristic_velocity.diminfo[1].shape;
16311  if (unlikely(__pyx_t_10 < 0)) __pyx_t_14 = 1;
16312  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_characteristic_velocity.diminfo[1].shape)) __pyx_t_14 = 1;
16313  if (__pyx_t_11 < 0) {
16314  __pyx_t_11 += __pyx_pybuffernd_characteristic_velocity.diminfo[2].shape;
16315  if (unlikely(__pyx_t_11 < 0)) __pyx_t_14 = 2;
16316  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_characteristic_velocity.diminfo[2].shape)) __pyx_t_14 = 2;
16317  if (unlikely(__pyx_t_14 != -1)) {
16318  __Pyx_RaiseBufferIndexError(__pyx_t_14);
16319  __PYX_ERR(0, 751, __pyx_L1_error)
16320  }
16321  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_characteristic_velocity.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_characteristic_velocity.diminfo[1].strides, __pyx_t_11, __pyx_pybuffernd_characteristic_velocity.diminfo[2].strides) = (__pyx_t_15 / __pyx_t_16);
16322  }
16323  }
16324  }
16325 
16326  /* "subsurfaceTransportFunctions.pyx":732
16327  * flux[eN,ebN] = integral
16328  *
16329  * def computeSimpleCharacteristicVelocityFromElementVelocity(numpy.ndarray[DTYPE_t,ndim=3] df, # <<<<<<<<<<<<<<
16330  * numpy.ndarray[DTYPE_t,ndim=3] characteristic_velocity,
16331  * numpy.ndarray[DTYPE_t,ndim=2] dm,
16332  */
16333 
16334  /* function exit code */
16335  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
16336  goto __pyx_L0;
16337  __pyx_L1_error:;
16338  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
16339  __Pyx_PyThreadState_declare
16340  __Pyx_PyThreadState_assign
16341  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
16342  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer);
16343  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
16344  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_df.rcbuffer->pybuffer);
16345  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dm.rcbuffer->pybuffer);
16346  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
16347  __Pyx_AddTraceback("subsurfaceTransportFunctions.computeSimpleCharacteristicVelocityFromElementVelocity", __pyx_clineno, __pyx_lineno, __pyx_filename);
16348  __pyx_r = NULL;
16349  goto __pyx_L2;
16350  __pyx_L0:;
16351  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_characteristic_velocity.rcbuffer->pybuffer);
16352  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
16353  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_df.rcbuffer->pybuffer);
16354  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dm.rcbuffer->pybuffer);
16355  __pyx_L2:;
16356  __Pyx_XGIVEREF(__pyx_r);
16357  __Pyx_RefNannyFinishContext();
16358  return __pyx_r;
16359 }
16360 
16361 /* "subsurfaceTransportFunctions.pyx":753
16362  * characteristic_velocity[eN,k,I] = df[eN,k,I]*vol_e/(omega_e+1.0e-12)
16363  *
16364  * def computeSimpleCharacteristicVelocityFromVelocityDOFs(numpy.ndarray[DTYPE_t,ndim=1] df_dofs, # <<<<<<<<<<<<<<
16365  * numpy.ndarray[DTYPE_t,ndim=1] characteristic_velocity_dofs,
16366  * numpy.ndarray[ITYPE_t,ndim=2] l2g,
16367  */
16368 
16369 /* Python wrapper */
16370 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_45computeSimpleCharacteristicVelocityFromVelocityDOFs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
16371 static char __pyx_doc_28subsurfaceTransportFunctions_44computeSimpleCharacteristicVelocityFromVelocityDOFs[] = "\n simple approximation for \\lambda = df/\010ar{dm} using \010ar{dm} = \014rac{1}{\\Omega_e} \\int_{\\Omega_e} dm dV\n ";
16372 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_45computeSimpleCharacteristicVelocityFromVelocityDOFs = {"computeSimpleCharacteristicVelocityFromVelocityDOFs", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_45computeSimpleCharacteristicVelocityFromVelocityDOFs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_28subsurfaceTransportFunctions_44computeSimpleCharacteristicVelocityFromVelocityDOFs};
16373 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_45computeSimpleCharacteristicVelocityFromVelocityDOFs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
16374  PyArrayObject *__pyx_v_df_dofs = 0;
16375  PyArrayObject *__pyx_v_characteristic_velocity_dofs = 0;
16376  PyArrayObject *__pyx_v_l2g = 0;
16377  PyArrayObject *__pyx_v_dm = 0;
16378  PyArrayObject *__pyx_v_dV = 0;
16379  int __pyx_lineno = 0;
16380  const char *__pyx_filename = NULL;
16381  int __pyx_clineno = 0;
16382  PyObject *__pyx_r = 0;
16383  __Pyx_RefNannyDeclarations
16384  __Pyx_RefNannySetupContext("computeSimpleCharacteristicVelocityFromVelocityDOFs (wrapper)", 0);
16385  {
16386  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_df_dofs,&__pyx_n_s_characteristic_velocity_dofs,&__pyx_n_s_l2g,&__pyx_n_s_dm,&__pyx_n_s_dV,0};
16387  PyObject* values[5] = {0,0,0,0,0};
16388  if (unlikely(__pyx_kwds)) {
16389  Py_ssize_t kw_args;
16390  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
16391  switch (pos_args) {
16392  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
16393  CYTHON_FALLTHROUGH;
16394  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
16395  CYTHON_FALLTHROUGH;
16396  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
16397  CYTHON_FALLTHROUGH;
16398  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
16399  CYTHON_FALLTHROUGH;
16400  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
16401  CYTHON_FALLTHROUGH;
16402  case 0: break;
16403  default: goto __pyx_L5_argtuple_error;
16404  }
16405  kw_args = PyDict_Size(__pyx_kwds);
16406  switch (pos_args) {
16407  case 0:
16408  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_df_dofs)) != 0)) kw_args--;
16409  else goto __pyx_L5_argtuple_error;
16410  CYTHON_FALLTHROUGH;
16411  case 1:
16412  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_characteristic_velocity_dofs)) != 0)) kw_args--;
16413  else {
16414  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromVelocityDOFs", 1, 5, 5, 1); __PYX_ERR(0, 753, __pyx_L3_error)
16415  }
16416  CYTHON_FALLTHROUGH;
16417  case 2:
16418  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_l2g)) != 0)) kw_args--;
16419  else {
16420  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromVelocityDOFs", 1, 5, 5, 2); __PYX_ERR(0, 753, __pyx_L3_error)
16421  }
16422  CYTHON_FALLTHROUGH;
16423  case 3:
16424  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dm)) != 0)) kw_args--;
16425  else {
16426  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromVelocityDOFs", 1, 5, 5, 3); __PYX_ERR(0, 753, __pyx_L3_error)
16427  }
16428  CYTHON_FALLTHROUGH;
16429  case 4:
16430  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dV)) != 0)) kw_args--;
16431  else {
16432  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromVelocityDOFs", 1, 5, 5, 4); __PYX_ERR(0, 753, __pyx_L3_error)
16433  }
16434  }
16435  if (unlikely(kw_args > 0)) {
16436  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "computeSimpleCharacteristicVelocityFromVelocityDOFs") < 0)) __PYX_ERR(0, 753, __pyx_L3_error)
16437  }
16438  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
16439  goto __pyx_L5_argtuple_error;
16440  } else {
16441  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
16442  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
16443  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
16444  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
16445  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
16446  }
16447  __pyx_v_df_dofs = ((PyArrayObject *)values[0]);
16448  __pyx_v_characteristic_velocity_dofs = ((PyArrayObject *)values[1]);
16449  __pyx_v_l2g = ((PyArrayObject *)values[2]);
16450  __pyx_v_dm = ((PyArrayObject *)values[3]);
16451  __pyx_v_dV = ((PyArrayObject *)values[4]);
16452  }
16453  goto __pyx_L4_argument_unpacking_done;
16454  __pyx_L5_argtuple_error:;
16455  __Pyx_RaiseArgtupleInvalid("computeSimpleCharacteristicVelocityFromVelocityDOFs", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 753, __pyx_L3_error)
16456  __pyx_L3_error:;
16457  __Pyx_AddTraceback("subsurfaceTransportFunctions.computeSimpleCharacteristicVelocityFromVelocityDOFs", __pyx_clineno, __pyx_lineno, __pyx_filename);
16458  __Pyx_RefNannyFinishContext();
16459  return NULL;
16460  __pyx_L4_argument_unpacking_done:;
16461  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_df_dofs), __pyx_ptype_5numpy_ndarray, 1, "df_dofs", 0))) __PYX_ERR(0, 753, __pyx_L1_error)
16462  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_characteristic_velocity_dofs), __pyx_ptype_5numpy_ndarray, 1, "characteristic_velocity_dofs", 0))) __PYX_ERR(0, 754, __pyx_L1_error)
16463  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_l2g), __pyx_ptype_5numpy_ndarray, 1, "l2g", 0))) __PYX_ERR(0, 755, __pyx_L1_error)
16464  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dm), __pyx_ptype_5numpy_ndarray, 1, "dm", 0))) __PYX_ERR(0, 756, __pyx_L1_error)
16465  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dV), __pyx_ptype_5numpy_ndarray, 1, "dV", 0))) __PYX_ERR(0, 757, __pyx_L1_error)
16466  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_44computeSimpleCharacteristicVelocityFromVelocityDOFs(__pyx_self, __pyx_v_df_dofs, __pyx_v_characteristic_velocity_dofs, __pyx_v_l2g, __pyx_v_dm, __pyx_v_dV);
16467 
16468  /* function exit code */
16469  goto __pyx_L0;
16470  __pyx_L1_error:;
16471  __pyx_r = NULL;
16472  __pyx_L0:;
16473  __Pyx_RefNannyFinishContext();
16474  return __pyx_r;
16475 }
16476 
16477 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_44computeSimpleCharacteristicVelocityFromVelocityDOFs(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_df_dofs, PyArrayObject *__pyx_v_characteristic_velocity_dofs, PyArrayObject *__pyx_v_l2g, PyArrayObject *__pyx_v_dm, PyArrayObject *__pyx_v_dV) {
16478  int __pyx_v_eN;
16479  int __pyx_v_k;
16480  int __pyx_v_j;
16481  int __pyx_v_J;
16482  double __pyx_v_omega_e;
16483  double __pyx_v_vol_e;
16484  __Pyx_LocalBuf_ND __pyx_pybuffernd_characteristic_velocity_dofs;
16485  __Pyx_Buffer __pyx_pybuffer_characteristic_velocity_dofs;
16486  __Pyx_LocalBuf_ND __pyx_pybuffernd_dV;
16487  __Pyx_Buffer __pyx_pybuffer_dV;
16488  __Pyx_LocalBuf_ND __pyx_pybuffernd_df_dofs;
16489  __Pyx_Buffer __pyx_pybuffer_df_dofs;
16490  __Pyx_LocalBuf_ND __pyx_pybuffernd_dm;
16491  __Pyx_Buffer __pyx_pybuffer_dm;
16492  __Pyx_LocalBuf_ND __pyx_pybuffernd_l2g;
16493  __Pyx_Buffer __pyx_pybuffer_l2g;
16494  PyObject *__pyx_r = NULL;
16495  __Pyx_RefNannyDeclarations
16496  npy_intp __pyx_t_1;
16497  npy_intp __pyx_t_2;
16498  int __pyx_t_3;
16499  npy_intp __pyx_t_4;
16500  npy_intp __pyx_t_5;
16501  int __pyx_t_6;
16502  Py_ssize_t __pyx_t_7;
16503  Py_ssize_t __pyx_t_8;
16504  int __pyx_t_9;
16505  Py_ssize_t __pyx_t_10;
16506  Py_ssize_t __pyx_t_11;
16507  __pyx_t_28subsurfaceTransportFunctions_DTYPE_t __pyx_t_12;
16508  double __pyx_t_13;
16509  int __pyx_lineno = 0;
16510  const char *__pyx_filename = NULL;
16511  int __pyx_clineno = 0;
16512  __Pyx_RefNannySetupContext("computeSimpleCharacteristicVelocityFromVelocityDOFs", 0);
16513  __pyx_pybuffer_df_dofs.pybuffer.buf = NULL;
16514  __pyx_pybuffer_df_dofs.refcount = 0;
16515  __pyx_pybuffernd_df_dofs.data = NULL;
16516  __pyx_pybuffernd_df_dofs.rcbuffer = &__pyx_pybuffer_df_dofs;
16517  __pyx_pybuffer_characteristic_velocity_dofs.pybuffer.buf = NULL;
16518  __pyx_pybuffer_characteristic_velocity_dofs.refcount = 0;
16519  __pyx_pybuffernd_characteristic_velocity_dofs.data = NULL;
16520  __pyx_pybuffernd_characteristic_velocity_dofs.rcbuffer = &__pyx_pybuffer_characteristic_velocity_dofs;
16521  __pyx_pybuffer_l2g.pybuffer.buf = NULL;
16522  __pyx_pybuffer_l2g.refcount = 0;
16523  __pyx_pybuffernd_l2g.data = NULL;
16524  __pyx_pybuffernd_l2g.rcbuffer = &__pyx_pybuffer_l2g;
16525  __pyx_pybuffer_dm.pybuffer.buf = NULL;
16526  __pyx_pybuffer_dm.refcount = 0;
16527  __pyx_pybuffernd_dm.data = NULL;
16528  __pyx_pybuffernd_dm.rcbuffer = &__pyx_pybuffer_dm;
16529  __pyx_pybuffer_dV.pybuffer.buf = NULL;
16530  __pyx_pybuffer_dV.refcount = 0;
16531  __pyx_pybuffernd_dV.data = NULL;
16532  __pyx_pybuffernd_dV.rcbuffer = &__pyx_pybuffer_dV;
16533  {
16534  __Pyx_BufFmt_StackElem __pyx_stack[1];
16535  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_df_dofs.rcbuffer->pybuffer, (PyObject*)__pyx_v_df_dofs, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 753, __pyx_L1_error)
16536  }
16537  __pyx_pybuffernd_df_dofs.diminfo[0].strides = __pyx_pybuffernd_df_dofs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_df_dofs.diminfo[0].shape = __pyx_pybuffernd_df_dofs.rcbuffer->pybuffer.shape[0];
16538  {
16539  __Pyx_BufFmt_StackElem __pyx_stack[1];
16540  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_characteristic_velocity_dofs.rcbuffer->pybuffer, (PyObject*)__pyx_v_characteristic_velocity_dofs, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 753, __pyx_L1_error)
16541  }
16542  __pyx_pybuffernd_characteristic_velocity_dofs.diminfo[0].strides = __pyx_pybuffernd_characteristic_velocity_dofs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_characteristic_velocity_dofs.diminfo[0].shape = __pyx_pybuffernd_characteristic_velocity_dofs.rcbuffer->pybuffer.shape[0];
16543  {
16544  __Pyx_BufFmt_StackElem __pyx_stack[1];
16545  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_l2g.rcbuffer->pybuffer, (PyObject*)__pyx_v_l2g, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_ITYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 753, __pyx_L1_error)
16546  }
16547  __pyx_pybuffernd_l2g.diminfo[0].strides = __pyx_pybuffernd_l2g.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_l2g.diminfo[0].shape = __pyx_pybuffernd_l2g.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_l2g.diminfo[1].strides = __pyx_pybuffernd_l2g.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_l2g.diminfo[1].shape = __pyx_pybuffernd_l2g.rcbuffer->pybuffer.shape[1];
16548  {
16549  __Pyx_BufFmt_StackElem __pyx_stack[1];
16550  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dm.rcbuffer->pybuffer, (PyObject*)__pyx_v_dm, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 753, __pyx_L1_error)
16551  }
16552  __pyx_pybuffernd_dm.diminfo[0].strides = __pyx_pybuffernd_dm.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dm.diminfo[0].shape = __pyx_pybuffernd_dm.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dm.diminfo[1].strides = __pyx_pybuffernd_dm.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dm.diminfo[1].shape = __pyx_pybuffernd_dm.rcbuffer->pybuffer.shape[1];
16553  {
16554  __Pyx_BufFmt_StackElem __pyx_stack[1];
16555  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dV.rcbuffer->pybuffer, (PyObject*)__pyx_v_dV, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 753, __pyx_L1_error)
16556  }
16557  __pyx_pybuffernd_dV.diminfo[0].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dV.diminfo[0].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dV.diminfo[1].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dV.diminfo[1].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[1];
16558 
16559  /* "subsurfaceTransportFunctions.pyx":765
16560  * cdef double omega_e, vol_e
16561  *
16562  * for eN in range(dm.shape[0]): # <<<<<<<<<<<<<<
16563  * omega_e = 0.0
16564  * vol_e = 0.0
16565  */
16566  __pyx_t_1 = (__pyx_v_dm->dimensions[0]);
16567  __pyx_t_2 = __pyx_t_1;
16568  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
16569  __pyx_v_eN = __pyx_t_3;
16570 
16571  /* "subsurfaceTransportFunctions.pyx":766
16572  *
16573  * for eN in range(dm.shape[0]):
16574  * omega_e = 0.0 # <<<<<<<<<<<<<<
16575  * vol_e = 0.0
16576  * for k in range(dm.shape[1]):
16577  */
16578  __pyx_v_omega_e = 0.0;
16579 
16580  /* "subsurfaceTransportFunctions.pyx":767
16581  * for eN in range(dm.shape[0]):
16582  * omega_e = 0.0
16583  * vol_e = 0.0 # <<<<<<<<<<<<<<
16584  * for k in range(dm.shape[1]):
16585  * vol_e += dV[eN,k]
16586  */
16587  __pyx_v_vol_e = 0.0;
16588 
16589  /* "subsurfaceTransportFunctions.pyx":768
16590  * omega_e = 0.0
16591  * vol_e = 0.0
16592  * for k in range(dm.shape[1]): # <<<<<<<<<<<<<<
16593  * vol_e += dV[eN,k]
16594  * omega_e += dV[eN,k]*dm[eN,k]
16595  */
16596  __pyx_t_4 = (__pyx_v_dm->dimensions[1]);
16597  __pyx_t_5 = __pyx_t_4;
16598  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
16599  __pyx_v_k = __pyx_t_6;
16600 
16601  /* "subsurfaceTransportFunctions.pyx":769
16602  * vol_e = 0.0
16603  * for k in range(dm.shape[1]):
16604  * vol_e += dV[eN,k] # <<<<<<<<<<<<<<
16605  * omega_e += dV[eN,k]*dm[eN,k]
16606  * for j in range(l2g.shape[1]):
16607  */
16608  __pyx_t_7 = __pyx_v_eN;
16609  __pyx_t_8 = __pyx_v_k;
16610  __pyx_t_9 = -1;
16611  if (__pyx_t_7 < 0) {
16612  __pyx_t_7 += __pyx_pybuffernd_dV.diminfo[0].shape;
16613  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 0;
16614  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_9 = 0;
16615  if (__pyx_t_8 < 0) {
16616  __pyx_t_8 += __pyx_pybuffernd_dV.diminfo[1].shape;
16617  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 1;
16618  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_9 = 1;
16619  if (unlikely(__pyx_t_9 != -1)) {
16620  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16621  __PYX_ERR(0, 769, __pyx_L1_error)
16622  }
16623  __pyx_v_vol_e = (__pyx_v_vol_e + (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_dV.diminfo[1].strides)));
16624 
16625  /* "subsurfaceTransportFunctions.pyx":770
16626  * for k in range(dm.shape[1]):
16627  * vol_e += dV[eN,k]
16628  * omega_e += dV[eN,k]*dm[eN,k] # <<<<<<<<<<<<<<
16629  * for j in range(l2g.shape[1]):
16630  * J = l2g[eN,j]
16631  */
16632  __pyx_t_8 = __pyx_v_eN;
16633  __pyx_t_7 = __pyx_v_k;
16634  __pyx_t_9 = -1;
16635  if (__pyx_t_8 < 0) {
16636  __pyx_t_8 += __pyx_pybuffernd_dV.diminfo[0].shape;
16637  if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0;
16638  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_dV.diminfo[0].shape)) __pyx_t_9 = 0;
16639  if (__pyx_t_7 < 0) {
16640  __pyx_t_7 += __pyx_pybuffernd_dV.diminfo[1].shape;
16641  if (unlikely(__pyx_t_7 < 0)) __pyx_t_9 = 1;
16642  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_dV.diminfo[1].shape)) __pyx_t_9 = 1;
16643  if (unlikely(__pyx_t_9 != -1)) {
16644  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16645  __PYX_ERR(0, 770, __pyx_L1_error)
16646  }
16647  __pyx_t_10 = __pyx_v_eN;
16648  __pyx_t_11 = __pyx_v_k;
16649  __pyx_t_9 = -1;
16650  if (__pyx_t_10 < 0) {
16651  __pyx_t_10 += __pyx_pybuffernd_dm.diminfo[0].shape;
16652  if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0;
16653  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_dm.diminfo[0].shape)) __pyx_t_9 = 0;
16654  if (__pyx_t_11 < 0) {
16655  __pyx_t_11 += __pyx_pybuffernd_dm.diminfo[1].shape;
16656  if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 1;
16657  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_dm.diminfo[1].shape)) __pyx_t_9 = 1;
16658  if (unlikely(__pyx_t_9 != -1)) {
16659  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16660  __PYX_ERR(0, 770, __pyx_L1_error)
16661  }
16662  __pyx_v_omega_e = (__pyx_v_omega_e + ((*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_dV.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_dV.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_dm.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_dm.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_dm.diminfo[1].strides))));
16663  }
16664 
16665  /* "subsurfaceTransportFunctions.pyx":771
16666  * vol_e += dV[eN,k]
16667  * omega_e += dV[eN,k]*dm[eN,k]
16668  * for j in range(l2g.shape[1]): # <<<<<<<<<<<<<<
16669  * J = l2g[eN,j]
16670  * characteristic_velocity_dofs[J] = df_dofs[J]*vol_e/(omega_e+1.0e-12)
16671  */
16672  __pyx_t_4 = (__pyx_v_l2g->dimensions[1]);
16673  __pyx_t_5 = __pyx_t_4;
16674  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
16675  __pyx_v_j = __pyx_t_6;
16676 
16677  /* "subsurfaceTransportFunctions.pyx":772
16678  * omega_e += dV[eN,k]*dm[eN,k]
16679  * for j in range(l2g.shape[1]):
16680  * J = l2g[eN,j] # <<<<<<<<<<<<<<
16681  * characteristic_velocity_dofs[J] = df_dofs[J]*vol_e/(omega_e+1.0e-12)
16682  *
16683  */
16684  __pyx_t_11 = __pyx_v_eN;
16685  __pyx_t_10 = __pyx_v_j;
16686  __pyx_t_9 = -1;
16687  if (__pyx_t_11 < 0) {
16688  __pyx_t_11 += __pyx_pybuffernd_l2g.diminfo[0].shape;
16689  if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 0;
16690  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_l2g.diminfo[0].shape)) __pyx_t_9 = 0;
16691  if (__pyx_t_10 < 0) {
16692  __pyx_t_10 += __pyx_pybuffernd_l2g.diminfo[1].shape;
16693  if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 1;
16694  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_l2g.diminfo[1].shape)) __pyx_t_9 = 1;
16695  if (unlikely(__pyx_t_9 != -1)) {
16696  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16697  __PYX_ERR(0, 772, __pyx_L1_error)
16698  }
16699  __pyx_v_J = (*__Pyx_BufPtrStrided2d(__pyx_t_28subsurfaceTransportFunctions_ITYPE_t *, __pyx_pybuffernd_l2g.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_l2g.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_l2g.diminfo[1].strides));
16700 
16701  /* "subsurfaceTransportFunctions.pyx":773
16702  * for j in range(l2g.shape[1]):
16703  * J = l2g[eN,j]
16704  * characteristic_velocity_dofs[J] = df_dofs[J]*vol_e/(omega_e+1.0e-12) # <<<<<<<<<<<<<<
16705  *
16706  * #problem specific velocity evaluation
16707  */
16708  __pyx_t_10 = __pyx_v_J;
16709  __pyx_t_9 = -1;
16710  if (__pyx_t_10 < 0) {
16711  __pyx_t_10 += __pyx_pybuffernd_df_dofs.diminfo[0].shape;
16712  if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0;
16713  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_df_dofs.diminfo[0].shape)) __pyx_t_9 = 0;
16714  if (unlikely(__pyx_t_9 != -1)) {
16715  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16716  __PYX_ERR(0, 773, __pyx_L1_error)
16717  }
16718  __pyx_t_12 = ((*__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_df_dofs.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_df_dofs.diminfo[0].strides)) * __pyx_v_vol_e);
16719  __pyx_t_13 = (__pyx_v_omega_e + 1.0e-12);
16720  if (unlikely(__pyx_t_13 == 0)) {
16721  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
16722  __PYX_ERR(0, 773, __pyx_L1_error)
16723  }
16724  __pyx_t_10 = __pyx_v_J;
16725  __pyx_t_9 = -1;
16726  if (__pyx_t_10 < 0) {
16727  __pyx_t_10 += __pyx_pybuffernd_characteristic_velocity_dofs.diminfo[0].shape;
16728  if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0;
16729  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_characteristic_velocity_dofs.diminfo[0].shape)) __pyx_t_9 = 0;
16730  if (unlikely(__pyx_t_9 != -1)) {
16731  __Pyx_RaiseBufferIndexError(__pyx_t_9);
16732  __PYX_ERR(0, 773, __pyx_L1_error)
16733  }
16734  *__Pyx_BufPtrStrided1d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_characteristic_velocity_dofs.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_characteristic_velocity_dofs.diminfo[0].strides) = (__pyx_t_12 / __pyx_t_13);
16735  }
16736  }
16737 
16738  /* "subsurfaceTransportFunctions.pyx":753
16739  * characteristic_velocity[eN,k,I] = df[eN,k,I]*vol_e/(omega_e+1.0e-12)
16740  *
16741  * def computeSimpleCharacteristicVelocityFromVelocityDOFs(numpy.ndarray[DTYPE_t,ndim=1] df_dofs, # <<<<<<<<<<<<<<
16742  * numpy.ndarray[DTYPE_t,ndim=1] characteristic_velocity_dofs,
16743  * numpy.ndarray[ITYPE_t,ndim=2] l2g,
16744  */
16745 
16746  /* function exit code */
16747  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
16748  goto __pyx_L0;
16749  __pyx_L1_error:;
16750  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
16751  __Pyx_PyThreadState_declare
16752  __Pyx_PyThreadState_assign
16753  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
16754  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_characteristic_velocity_dofs.rcbuffer->pybuffer);
16755  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
16756  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_df_dofs.rcbuffer->pybuffer);
16757  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dm.rcbuffer->pybuffer);
16758  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_l2g.rcbuffer->pybuffer);
16759  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
16760  __Pyx_AddTraceback("subsurfaceTransportFunctions.computeSimpleCharacteristicVelocityFromVelocityDOFs", __pyx_clineno, __pyx_lineno, __pyx_filename);
16761  __pyx_r = NULL;
16762  goto __pyx_L2;
16763  __pyx_L0:;
16764  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_characteristic_velocity_dofs.rcbuffer->pybuffer);
16765  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
16766  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_df_dofs.rcbuffer->pybuffer);
16767  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dm.rcbuffer->pybuffer);
16768  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_l2g.rcbuffer->pybuffer);
16769  __pyx_L2:;
16770  __Pyx_XGIVEREF(__pyx_r);
16771  __Pyx_RefNannyFinishContext();
16772  return __pyx_r;
16773 }
16774 
16775 /* "subsurfaceTransportFunctions.pyx":776
16776  *
16777  * #problem specific velocity evaluation
16778  * def rotatingGaussianElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
16779  * double t,
16780  * double tForReversal,
16781  */
16782 
16783 /* Python wrapper */
16784 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_47rotatingGaussianElementVelocityEval3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
16785 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_47rotatingGaussianElementVelocityEval3 = {"rotatingGaussianElementVelocityEval3", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_47rotatingGaussianElementVelocityEval3, METH_VARARGS|METH_KEYWORDS, 0};
16786 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_47rotatingGaussianElementVelocityEval3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
16787  int __pyx_v_transient;
16788  double __pyx_v_t;
16789  double __pyx_v_tForReversal;
16790  double __pyx_v_clock;
16791  double __pyx_v_xc;
16792  double __pyx_v_yc;
16793  PyArrayObject *__pyx_v_x = 0;
16794  PyArrayObject *__pyx_v_v = 0;
16795  double __pyx_v_zvelocity;
16796  int __pyx_lineno = 0;
16797  const char *__pyx_filename = NULL;
16798  int __pyx_clineno = 0;
16799  PyObject *__pyx_r = 0;
16800  __Pyx_RefNannyDeclarations
16801  __Pyx_RefNannySetupContext("rotatingGaussianElementVelocityEval3 (wrapper)", 0);
16802  {
16803  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_transient,&__pyx_n_s_t,&__pyx_n_s_tForReversal,&__pyx_n_s_clock,&__pyx_n_s_xc,&__pyx_n_s_yc,&__pyx_n_s_x,&__pyx_n_s_v,&__pyx_n_s_zvelocity,0};
16804  PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
16805  if (unlikely(__pyx_kwds)) {
16806  Py_ssize_t kw_args;
16807  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
16808  switch (pos_args) {
16809  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
16810  CYTHON_FALLTHROUGH;
16811  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
16812  CYTHON_FALLTHROUGH;
16813  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
16814  CYTHON_FALLTHROUGH;
16815  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
16816  CYTHON_FALLTHROUGH;
16817  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
16818  CYTHON_FALLTHROUGH;
16819  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
16820  CYTHON_FALLTHROUGH;
16821  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
16822  CYTHON_FALLTHROUGH;
16823  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
16824  CYTHON_FALLTHROUGH;
16825  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
16826  CYTHON_FALLTHROUGH;
16827  case 0: break;
16828  default: goto __pyx_L5_argtuple_error;
16829  }
16830  kw_args = PyDict_Size(__pyx_kwds);
16831  switch (pos_args) {
16832  case 0:
16833  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_transient)) != 0)) kw_args--;
16834  else goto __pyx_L5_argtuple_error;
16835  CYTHON_FALLTHROUGH;
16836  case 1:
16837  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
16838  else {
16839  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, 1); __PYX_ERR(0, 776, __pyx_L3_error)
16840  }
16841  CYTHON_FALLTHROUGH;
16842  case 2:
16843  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tForReversal)) != 0)) kw_args--;
16844  else {
16845  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, 2); __PYX_ERR(0, 776, __pyx_L3_error)
16846  }
16847  CYTHON_FALLTHROUGH;
16848  case 3:
16849  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_clock)) != 0)) kw_args--;
16850  else {
16851  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, 3); __PYX_ERR(0, 776, __pyx_L3_error)
16852  }
16853  CYTHON_FALLTHROUGH;
16854  case 4:
16855  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xc)) != 0)) kw_args--;
16856  else {
16857  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, 4); __PYX_ERR(0, 776, __pyx_L3_error)
16858  }
16859  CYTHON_FALLTHROUGH;
16860  case 5:
16861  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_yc)) != 0)) kw_args--;
16862  else {
16863  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, 5); __PYX_ERR(0, 776, __pyx_L3_error)
16864  }
16865  CYTHON_FALLTHROUGH;
16866  case 6:
16867  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
16868  else {
16869  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, 6); __PYX_ERR(0, 776, __pyx_L3_error)
16870  }
16871  CYTHON_FALLTHROUGH;
16872  case 7:
16873  if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
16874  else {
16875  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, 7); __PYX_ERR(0, 776, __pyx_L3_error)
16876  }
16877  CYTHON_FALLTHROUGH;
16878  case 8:
16879  if (kw_args > 0) {
16880  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_zvelocity);
16881  if (value) { values[8] = value; kw_args--; }
16882  }
16883  }
16884  if (unlikely(kw_args > 0)) {
16885  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rotatingGaussianElementVelocityEval3") < 0)) __PYX_ERR(0, 776, __pyx_L3_error)
16886  }
16887  } else {
16888  switch (PyTuple_GET_SIZE(__pyx_args)) {
16889  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
16890  CYTHON_FALLTHROUGH;
16891  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
16892  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
16893  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
16894  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
16895  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
16896  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
16897  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
16898  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
16899  break;
16900  default: goto __pyx_L5_argtuple_error;
16901  }
16902  }
16903  __pyx_v_transient = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_transient == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 776, __pyx_L3_error)
16904  __pyx_v_t = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 777, __pyx_L3_error)
16905  __pyx_v_tForReversal = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_tForReversal == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 778, __pyx_L3_error)
16906  __pyx_v_clock = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_clock == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 779, __pyx_L3_error)
16907  __pyx_v_xc = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_xc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 780, __pyx_L3_error)
16908  __pyx_v_yc = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_yc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 780, __pyx_L3_error)
16909  __pyx_v_x = ((PyArrayObject *)values[6]);
16910  __pyx_v_v = ((PyArrayObject *)values[7]);
16911  if (values[8]) {
16912  __pyx_v_zvelocity = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_zvelocity == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 783, __pyx_L3_error)
16913  } else {
16914  __pyx_v_zvelocity = ((double)0.0);
16915  }
16916  }
16917  goto __pyx_L4_argument_unpacking_done;
16918  __pyx_L5_argtuple_error:;
16919  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval3", 0, 8, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 776, __pyx_L3_error)
16920  __pyx_L3_error:;
16921  __Pyx_AddTraceback("subsurfaceTransportFunctions.rotatingGaussianElementVelocityEval3", __pyx_clineno, __pyx_lineno, __pyx_filename);
16922  __Pyx_RefNannyFinishContext();
16923  return NULL;
16924  __pyx_L4_argument_unpacking_done:;
16925  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 781, __pyx_L1_error)
16926  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 782, __pyx_L1_error)
16927  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_46rotatingGaussianElementVelocityEval3(__pyx_self, __pyx_v_transient, __pyx_v_t, __pyx_v_tForReversal, __pyx_v_clock, __pyx_v_xc, __pyx_v_yc, __pyx_v_x, __pyx_v_v, __pyx_v_zvelocity);
16928 
16929  /* function exit code */
16930  goto __pyx_L0;
16931  __pyx_L1_error:;
16932  __pyx_r = NULL;
16933  __pyx_L0:;
16934  __Pyx_RefNannyFinishContext();
16935  return __pyx_r;
16936 }
16937 
16938 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_46rotatingGaussianElementVelocityEval3(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v, double __pyx_v_zvelocity) {
16939  int __pyx_v_eN;
16940  int __pyx_v_k;
16941  double __pyx_v_pi;
16942  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
16943  __Pyx_Buffer __pyx_pybuffer_v;
16944  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
16945  __Pyx_Buffer __pyx_pybuffer_x;
16946  PyObject *__pyx_r = NULL;
16947  __Pyx_RefNannyDeclarations
16948  int __pyx_t_1;
16949  npy_intp __pyx_t_2;
16950  npy_intp __pyx_t_3;
16951  int __pyx_t_4;
16952  npy_intp __pyx_t_5;
16953  npy_intp __pyx_t_6;
16954  int __pyx_t_7;
16955  Py_ssize_t __pyx_t_8;
16956  Py_ssize_t __pyx_t_9;
16957  Py_ssize_t __pyx_t_10;
16958  int __pyx_t_11;
16959  Py_ssize_t __pyx_t_12;
16960  Py_ssize_t __pyx_t_13;
16961  Py_ssize_t __pyx_t_14;
16962  PyObject *__pyx_t_15 = NULL;
16963  PyObject *__pyx_t_16 = NULL;
16964  PyObject *__pyx_t_17 = NULL;
16965  double __pyx_t_18;
16966  double __pyx_t_19;
16967  PyObject *__pyx_t_20 = NULL;
16968  int __pyx_lineno = 0;
16969  const char *__pyx_filename = NULL;
16970  int __pyx_clineno = 0;
16971  __Pyx_RefNannySetupContext("rotatingGaussianElementVelocityEval3", 0);
16972  __pyx_pybuffer_x.pybuffer.buf = NULL;
16973  __pyx_pybuffer_x.refcount = 0;
16974  __pyx_pybuffernd_x.data = NULL;
16975  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
16976  __pyx_pybuffer_v.pybuffer.buf = NULL;
16977  __pyx_pybuffer_v.refcount = 0;
16978  __pyx_pybuffernd_v.data = NULL;
16979  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
16980  {
16981  __Pyx_BufFmt_StackElem __pyx_stack[1];
16982  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 776, __pyx_L1_error)
16983  }
16984  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2];
16985  {
16986  __Pyx_BufFmt_StackElem __pyx_stack[1];
16987  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 776, __pyx_L1_error)
16988  }
16989  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2];
16990 
16991  /* "subsurfaceTransportFunctions.pyx":786
16992  * cdef int eN,k
16993  * cdef double pi
16994  * pi = M_PI # <<<<<<<<<<<<<<
16995  * if v.shape[2] == 3:
16996  * if transient == 1:
16997  */
16998  __pyx_v_pi = M_PI;
16999 
17000  /* "subsurfaceTransportFunctions.pyx":787
17001  * cdef double pi
17002  * pi = M_PI
17003  * if v.shape[2] == 3: # <<<<<<<<<<<<<<
17004  * if transient == 1:
17005  * for eN in range(x.shape[0]):
17006  */
17007  __pyx_t_1 = (((__pyx_v_v->dimensions[2]) == 3) != 0);
17008  if (__pyx_t_1) {
17009 
17010  /* "subsurfaceTransportFunctions.pyx":788
17011  * pi = M_PI
17012  * if v.shape[2] == 3:
17013  * if transient == 1: # <<<<<<<<<<<<<<
17014  * for eN in range(x.shape[0]):
17015  * for k in range(x.shape[1]):
17016  */
17017  __pyx_t_1 = ((__pyx_v_transient == 1) != 0);
17018  if (__pyx_t_1) {
17019 
17020  /* "subsurfaceTransportFunctions.pyx":789
17021  * if v.shape[2] == 3:
17022  * if transient == 1:
17023  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
17024  * for k in range(x.shape[1]):
17025  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17026  */
17027  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
17028  __pyx_t_3 = __pyx_t_2;
17029  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
17030  __pyx_v_eN = __pyx_t_4;
17031 
17032  /* "subsurfaceTransportFunctions.pyx":790
17033  * if transient == 1:
17034  * for eN in range(x.shape[0]):
17035  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
17036  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17037  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17038  */
17039  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
17040  __pyx_t_6 = __pyx_t_5;
17041  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
17042  __pyx_v_k = __pyx_t_7;
17043 
17044  /* "subsurfaceTransportFunctions.pyx":791
17045  * for eN in range(x.shape[0]):
17046  * for k in range(x.shape[1]):
17047  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc) # <<<<<<<<<<<<<<
17048  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17049  * v[eN,k,2]=zvelocity
17050  */
17051  __pyx_t_8 = __pyx_v_eN;
17052  __pyx_t_9 = __pyx_v_k;
17053  __pyx_t_10 = 1;
17054  __pyx_t_11 = -1;
17055  if (__pyx_t_8 < 0) {
17056  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[0].shape;
17057  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 0;
17058  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
17059  if (__pyx_t_9 < 0) {
17060  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[1].shape;
17061  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
17062  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
17063  if (__pyx_t_10 < 0) {
17064  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[2].shape;
17065  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 2;
17066  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
17067  if (unlikely(__pyx_t_11 != -1)) {
17068  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17069  __PYX_ERR(0, 791, __pyx_L1_error)
17070  }
17071  __pyx_t_12 = __pyx_v_eN;
17072  __pyx_t_13 = __pyx_v_k;
17073  __pyx_t_14 = 0;
17074  __pyx_t_11 = -1;
17075  if (__pyx_t_12 < 0) {
17076  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[0].shape;
17077  if (unlikely(__pyx_t_12 < 0)) __pyx_t_11 = 0;
17078  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17079  if (__pyx_t_13 < 0) {
17080  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[1].shape;
17081  if (unlikely(__pyx_t_13 < 0)) __pyx_t_11 = 1;
17082  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17083  if (__pyx_t_14 < 0) {
17084  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[2].shape;
17085  if (unlikely(__pyx_t_14 < 0)) __pyx_t_11 = 2;
17086  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17087  if (unlikely(__pyx_t_11 != -1)) {
17088  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17089  __PYX_ERR(0, 791, __pyx_L1_error)
17090  }
17091  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_14, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_10, __pyx_pybuffernd_x.diminfo[2].strides)) - __pyx_v_xc));
17092 
17093  /* "subsurfaceTransportFunctions.pyx":792
17094  * for k in range(x.shape[1]):
17095  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17096  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0]) # <<<<<<<<<<<<<<
17097  * v[eN,k,2]=zvelocity
17098  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
17099  */
17100  __pyx_t_10 = __pyx_v_eN;
17101  __pyx_t_9 = __pyx_v_k;
17102  __pyx_t_8 = 0;
17103  __pyx_t_11 = -1;
17104  if (__pyx_t_10 < 0) {
17105  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[0].shape;
17106  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 0;
17107  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
17108  if (__pyx_t_9 < 0) {
17109  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[1].shape;
17110  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
17111  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
17112  if (__pyx_t_8 < 0) {
17113  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[2].shape;
17114  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 2;
17115  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
17116  if (unlikely(__pyx_t_11 != -1)) {
17117  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17118  __PYX_ERR(0, 792, __pyx_L1_error)
17119  }
17120  __pyx_t_14 = __pyx_v_eN;
17121  __pyx_t_13 = __pyx_v_k;
17122  __pyx_t_12 = 1;
17123  __pyx_t_11 = -1;
17124  if (__pyx_t_14 < 0) {
17125  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[0].shape;
17126  if (unlikely(__pyx_t_14 < 0)) __pyx_t_11 = 0;
17127  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17128  if (__pyx_t_13 < 0) {
17129  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[1].shape;
17130  if (unlikely(__pyx_t_13 < 0)) __pyx_t_11 = 1;
17131  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17132  if (__pyx_t_12 < 0) {
17133  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[2].shape;
17134  if (unlikely(__pyx_t_12 < 0)) __pyx_t_11 = 2;
17135  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17136  if (unlikely(__pyx_t_11 != -1)) {
17137  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17138  __PYX_ERR(0, 792, __pyx_L1_error)
17139  }
17140  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_8, __pyx_pybuffernd_x.diminfo[2].strides))));
17141 
17142  /* "subsurfaceTransportFunctions.pyx":793
17143  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17144  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17145  * v[eN,k,2]=zvelocity # <<<<<<<<<<<<<<
17146  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
17147  * else:
17148  */
17149  __pyx_t_8 = __pyx_v_eN;
17150  __pyx_t_9 = __pyx_v_k;
17151  __pyx_t_10 = 2;
17152  __pyx_t_11 = -1;
17153  if (__pyx_t_8 < 0) {
17154  __pyx_t_8 += __pyx_pybuffernd_v.diminfo[0].shape;
17155  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 0;
17156  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17157  if (__pyx_t_9 < 0) {
17158  __pyx_t_9 += __pyx_pybuffernd_v.diminfo[1].shape;
17159  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
17160  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17161  if (__pyx_t_10 < 0) {
17162  __pyx_t_10 += __pyx_pybuffernd_v.diminfo[2].shape;
17163  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 2;
17164  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17165  if (unlikely(__pyx_t_11 != -1)) {
17166  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17167  __PYX_ERR(0, 793, __pyx_L1_error)
17168  }
17169  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_10, __pyx_pybuffernd_v.diminfo[2].strides) = __pyx_v_zvelocity;
17170 
17171  /* "subsurfaceTransportFunctions.pyx":794
17172  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17173  * v[eN,k,2]=zvelocity
17174  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock # <<<<<<<<<<<<<<
17175  * else:
17176  * for eN in range(x.shape[0]):
17177  */
17178  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 794, __pyx_L1_error)
17179  __Pyx_GOTREF(__pyx_t_15);
17180  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 794, __pyx_L1_error)
17181  __Pyx_GOTREF(__pyx_t_16);
17182  __pyx_t_17 = PyTuple_New(3); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 794, __pyx_L1_error)
17183  __Pyx_GOTREF(__pyx_t_17);
17184  __Pyx_GIVEREF(__pyx_t_15);
17185  PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_15);
17186  __Pyx_GIVEREF(__pyx_t_16);
17187  PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_16);
17188  __Pyx_INCREF(__pyx_slice_);
17189  __Pyx_GIVEREF(__pyx_slice_);
17190  PyTuple_SET_ITEM(__pyx_t_17, 2, __pyx_slice_);
17191  __pyx_t_15 = 0;
17192  __pyx_t_16 = 0;
17193  __pyx_t_16 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_v), __pyx_t_17); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 794, __pyx_L1_error)
17194  __Pyx_GOTREF(__pyx_t_16);
17195  __pyx_t_18 = (__pyx_v_tForReversal - __pyx_v_t);
17196  __pyx_t_19 = (__pyx_v_tForReversal - 0.0);
17197  if (unlikely(__pyx_t_19 == 0)) {
17198  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
17199  __PYX_ERR(0, 794, __pyx_L1_error)
17200  }
17201  __pyx_t_15 = PyFloat_FromDouble(((__pyx_t_18 / __pyx_t_19) * __pyx_v_clock)); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 794, __pyx_L1_error)
17202  __Pyx_GOTREF(__pyx_t_15);
17203  __pyx_t_20 = PyNumber_InPlaceMultiply(__pyx_t_16, __pyx_t_15); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 794, __pyx_L1_error)
17204  __Pyx_GOTREF(__pyx_t_20);
17205  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
17206  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
17207  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_v), __pyx_t_17, __pyx_t_20) < 0)) __PYX_ERR(0, 794, __pyx_L1_error)
17208  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
17209  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
17210  }
17211  }
17212 
17213  /* "subsurfaceTransportFunctions.pyx":788
17214  * pi = M_PI
17215  * if v.shape[2] == 3:
17216  * if transient == 1: # <<<<<<<<<<<<<<
17217  * for eN in range(x.shape[0]):
17218  * for k in range(x.shape[1]):
17219  */
17220  goto __pyx_L4;
17221  }
17222 
17223  /* "subsurfaceTransportFunctions.pyx":796
17224  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
17225  * else:
17226  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
17227  * for k in range(x.shape[1]):
17228  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17229  */
17230  /*else*/ {
17231  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
17232  __pyx_t_3 = __pyx_t_2;
17233  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
17234  __pyx_v_eN = __pyx_t_4;
17235 
17236  /* "subsurfaceTransportFunctions.pyx":797
17237  * else:
17238  * for eN in range(x.shape[0]):
17239  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
17240  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17241  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17242  */
17243  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
17244  __pyx_t_6 = __pyx_t_5;
17245  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
17246  __pyx_v_k = __pyx_t_7;
17247 
17248  /* "subsurfaceTransportFunctions.pyx":798
17249  * for eN in range(x.shape[0]):
17250  * for k in range(x.shape[1]):
17251  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc) # <<<<<<<<<<<<<<
17252  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17253  * v[eN,k,2]=zvelocity
17254  */
17255  __pyx_t_10 = __pyx_v_eN;
17256  __pyx_t_9 = __pyx_v_k;
17257  __pyx_t_8 = 1;
17258  __pyx_t_11 = -1;
17259  if (__pyx_t_10 < 0) {
17260  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[0].shape;
17261  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 0;
17262  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
17263  if (__pyx_t_9 < 0) {
17264  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[1].shape;
17265  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
17266  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
17267  if (__pyx_t_8 < 0) {
17268  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[2].shape;
17269  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 2;
17270  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
17271  if (unlikely(__pyx_t_11 != -1)) {
17272  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17273  __PYX_ERR(0, 798, __pyx_L1_error)
17274  }
17275  __pyx_t_12 = __pyx_v_eN;
17276  __pyx_t_13 = __pyx_v_k;
17277  __pyx_t_14 = 0;
17278  __pyx_t_11 = -1;
17279  if (__pyx_t_12 < 0) {
17280  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[0].shape;
17281  if (unlikely(__pyx_t_12 < 0)) __pyx_t_11 = 0;
17282  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17283  if (__pyx_t_13 < 0) {
17284  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[1].shape;
17285  if (unlikely(__pyx_t_13 < 0)) __pyx_t_11 = 1;
17286  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17287  if (__pyx_t_14 < 0) {
17288  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[2].shape;
17289  if (unlikely(__pyx_t_14 < 0)) __pyx_t_11 = 2;
17290  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17291  if (unlikely(__pyx_t_11 != -1)) {
17292  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17293  __PYX_ERR(0, 798, __pyx_L1_error)
17294  }
17295  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_14, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_8, __pyx_pybuffernd_x.diminfo[2].strides)) - __pyx_v_xc));
17296 
17297  /* "subsurfaceTransportFunctions.pyx":799
17298  * for k in range(x.shape[1]):
17299  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17300  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0]) # <<<<<<<<<<<<<<
17301  * v[eN,k,2]=zvelocity
17302  * else:
17303  */
17304  __pyx_t_8 = __pyx_v_eN;
17305  __pyx_t_9 = __pyx_v_k;
17306  __pyx_t_10 = 0;
17307  __pyx_t_11 = -1;
17308  if (__pyx_t_8 < 0) {
17309  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[0].shape;
17310  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 0;
17311  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
17312  if (__pyx_t_9 < 0) {
17313  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[1].shape;
17314  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
17315  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
17316  if (__pyx_t_10 < 0) {
17317  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[2].shape;
17318  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 2;
17319  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
17320  if (unlikely(__pyx_t_11 != -1)) {
17321  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17322  __PYX_ERR(0, 799, __pyx_L1_error)
17323  }
17324  __pyx_t_14 = __pyx_v_eN;
17325  __pyx_t_13 = __pyx_v_k;
17326  __pyx_t_12 = 1;
17327  __pyx_t_11 = -1;
17328  if (__pyx_t_14 < 0) {
17329  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[0].shape;
17330  if (unlikely(__pyx_t_14 < 0)) __pyx_t_11 = 0;
17331  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17332  if (__pyx_t_13 < 0) {
17333  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[1].shape;
17334  if (unlikely(__pyx_t_13 < 0)) __pyx_t_11 = 1;
17335  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17336  if (__pyx_t_12 < 0) {
17337  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[2].shape;
17338  if (unlikely(__pyx_t_12 < 0)) __pyx_t_11 = 2;
17339  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17340  if (unlikely(__pyx_t_11 != -1)) {
17341  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17342  __PYX_ERR(0, 799, __pyx_L1_error)
17343  }
17344  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_10, __pyx_pybuffernd_x.diminfo[2].strides))));
17345 
17346  /* "subsurfaceTransportFunctions.pyx":800
17347  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17348  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17349  * v[eN,k,2]=zvelocity # <<<<<<<<<<<<<<
17350  * else:
17351  * assert v.shape[2] == 2
17352  */
17353  __pyx_t_10 = __pyx_v_eN;
17354  __pyx_t_9 = __pyx_v_k;
17355  __pyx_t_8 = 2;
17356  __pyx_t_11 = -1;
17357  if (__pyx_t_10 < 0) {
17358  __pyx_t_10 += __pyx_pybuffernd_v.diminfo[0].shape;
17359  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 0;
17360  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17361  if (__pyx_t_9 < 0) {
17362  __pyx_t_9 += __pyx_pybuffernd_v.diminfo[1].shape;
17363  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
17364  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17365  if (__pyx_t_8 < 0) {
17366  __pyx_t_8 += __pyx_pybuffernd_v.diminfo[2].shape;
17367  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 2;
17368  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17369  if (unlikely(__pyx_t_11 != -1)) {
17370  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17371  __PYX_ERR(0, 800, __pyx_L1_error)
17372  }
17373  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_8, __pyx_pybuffernd_v.diminfo[2].strides) = __pyx_v_zvelocity;
17374  }
17375  }
17376  }
17377  __pyx_L4:;
17378 
17379  /* "subsurfaceTransportFunctions.pyx":787
17380  * cdef double pi
17381  * pi = M_PI
17382  * if v.shape[2] == 3: # <<<<<<<<<<<<<<
17383  * if transient == 1:
17384  * for eN in range(x.shape[0]):
17385  */
17386  goto __pyx_L3;
17387  }
17388 
17389  /* "subsurfaceTransportFunctions.pyx":802
17390  * v[eN,k,2]=zvelocity
17391  * else:
17392  * assert v.shape[2] == 2 # <<<<<<<<<<<<<<
17393  * if transient == 1:
17394  * for eN in range(x.shape[0]):
17395  */
17396  /*else*/ {
17397  #ifndef CYTHON_WITHOUT_ASSERTIONS
17398  if (unlikely(!Py_OptimizeFlag)) {
17399  if (unlikely(!(((__pyx_v_v->dimensions[2]) == 2) != 0))) {
17400  PyErr_SetNone(PyExc_AssertionError);
17401  __PYX_ERR(0, 802, __pyx_L1_error)
17402  }
17403  }
17404  #endif
17405 
17406  /* "subsurfaceTransportFunctions.pyx":803
17407  * else:
17408  * assert v.shape[2] == 2
17409  * if transient == 1: # <<<<<<<<<<<<<<
17410  * for eN in range(x.shape[0]):
17411  * for k in range(x.shape[1]):
17412  */
17413  __pyx_t_1 = ((__pyx_v_transient == 1) != 0);
17414  if (__pyx_t_1) {
17415 
17416  /* "subsurfaceTransportFunctions.pyx":804
17417  * assert v.shape[2] == 2
17418  * if transient == 1:
17419  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
17420  * for k in range(x.shape[1]):
17421  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17422  */
17423  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
17424  __pyx_t_3 = __pyx_t_2;
17425  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
17426  __pyx_v_eN = __pyx_t_4;
17427 
17428  /* "subsurfaceTransportFunctions.pyx":805
17429  * if transient == 1:
17430  * for eN in range(x.shape[0]):
17431  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
17432  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17433  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17434  */
17435  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
17436  __pyx_t_6 = __pyx_t_5;
17437  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
17438  __pyx_v_k = __pyx_t_7;
17439 
17440  /* "subsurfaceTransportFunctions.pyx":806
17441  * for eN in range(x.shape[0]):
17442  * for k in range(x.shape[1]):
17443  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc) # <<<<<<<<<<<<<<
17444  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17445  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
17446  */
17447  __pyx_t_8 = __pyx_v_eN;
17448  __pyx_t_9 = __pyx_v_k;
17449  __pyx_t_10 = 1;
17450  __pyx_t_11 = -1;
17451  if (__pyx_t_8 < 0) {
17452  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[0].shape;
17453  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 0;
17454  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
17455  if (__pyx_t_9 < 0) {
17456  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[1].shape;
17457  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
17458  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
17459  if (__pyx_t_10 < 0) {
17460  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[2].shape;
17461  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 2;
17462  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
17463  if (unlikely(__pyx_t_11 != -1)) {
17464  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17465  __PYX_ERR(0, 806, __pyx_L1_error)
17466  }
17467  __pyx_t_12 = __pyx_v_eN;
17468  __pyx_t_13 = __pyx_v_k;
17469  __pyx_t_14 = 0;
17470  __pyx_t_11 = -1;
17471  if (__pyx_t_12 < 0) {
17472  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[0].shape;
17473  if (unlikely(__pyx_t_12 < 0)) __pyx_t_11 = 0;
17474  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17475  if (__pyx_t_13 < 0) {
17476  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[1].shape;
17477  if (unlikely(__pyx_t_13 < 0)) __pyx_t_11 = 1;
17478  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17479  if (__pyx_t_14 < 0) {
17480  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[2].shape;
17481  if (unlikely(__pyx_t_14 < 0)) __pyx_t_11 = 2;
17482  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17483  if (unlikely(__pyx_t_11 != -1)) {
17484  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17485  __PYX_ERR(0, 806, __pyx_L1_error)
17486  }
17487  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_14, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_10, __pyx_pybuffernd_x.diminfo[2].strides)) - __pyx_v_xc));
17488 
17489  /* "subsurfaceTransportFunctions.pyx":807
17490  * for k in range(x.shape[1]):
17491  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17492  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0]) # <<<<<<<<<<<<<<
17493  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
17494  * else:
17495  */
17496  __pyx_t_10 = __pyx_v_eN;
17497  __pyx_t_9 = __pyx_v_k;
17498  __pyx_t_8 = 0;
17499  __pyx_t_11 = -1;
17500  if (__pyx_t_10 < 0) {
17501  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[0].shape;
17502  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 0;
17503  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
17504  if (__pyx_t_9 < 0) {
17505  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[1].shape;
17506  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
17507  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
17508  if (__pyx_t_8 < 0) {
17509  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[2].shape;
17510  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 2;
17511  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
17512  if (unlikely(__pyx_t_11 != -1)) {
17513  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17514  __PYX_ERR(0, 807, __pyx_L1_error)
17515  }
17516  __pyx_t_14 = __pyx_v_eN;
17517  __pyx_t_13 = __pyx_v_k;
17518  __pyx_t_12 = 1;
17519  __pyx_t_11 = -1;
17520  if (__pyx_t_14 < 0) {
17521  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[0].shape;
17522  if (unlikely(__pyx_t_14 < 0)) __pyx_t_11 = 0;
17523  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17524  if (__pyx_t_13 < 0) {
17525  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[1].shape;
17526  if (unlikely(__pyx_t_13 < 0)) __pyx_t_11 = 1;
17527  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17528  if (__pyx_t_12 < 0) {
17529  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[2].shape;
17530  if (unlikely(__pyx_t_12 < 0)) __pyx_t_11 = 2;
17531  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17532  if (unlikely(__pyx_t_11 != -1)) {
17533  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17534  __PYX_ERR(0, 807, __pyx_L1_error)
17535  }
17536  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_8, __pyx_pybuffernd_x.diminfo[2].strides))));
17537 
17538  /* "subsurfaceTransportFunctions.pyx":808
17539  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17540  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17541  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock # <<<<<<<<<<<<<<
17542  * else:
17543  * for eN in range(x.shape[0]):
17544  */
17545  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 808, __pyx_L1_error)
17546  __Pyx_GOTREF(__pyx_t_17);
17547  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 808, __pyx_L1_error)
17548  __Pyx_GOTREF(__pyx_t_20);
17549  __pyx_t_15 = PyTuple_New(3); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 808, __pyx_L1_error)
17550  __Pyx_GOTREF(__pyx_t_15);
17551  __Pyx_GIVEREF(__pyx_t_17);
17552  PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_17);
17553  __Pyx_GIVEREF(__pyx_t_20);
17554  PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_20);
17555  __Pyx_INCREF(__pyx_slice_);
17556  __Pyx_GIVEREF(__pyx_slice_);
17557  PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_slice_);
17558  __pyx_t_17 = 0;
17559  __pyx_t_20 = 0;
17560  __pyx_t_20 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_v), __pyx_t_15); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 808, __pyx_L1_error)
17561  __Pyx_GOTREF(__pyx_t_20);
17562  __pyx_t_19 = (__pyx_v_tForReversal - __pyx_v_t);
17563  __pyx_t_18 = (__pyx_v_tForReversal - 0.0);
17564  if (unlikely(__pyx_t_18 == 0)) {
17565  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
17566  __PYX_ERR(0, 808, __pyx_L1_error)
17567  }
17568  __pyx_t_17 = PyFloat_FromDouble(((__pyx_t_19 / __pyx_t_18) * __pyx_v_clock)); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 808, __pyx_L1_error)
17569  __Pyx_GOTREF(__pyx_t_17);
17570  __pyx_t_16 = PyNumber_InPlaceMultiply(__pyx_t_20, __pyx_t_17); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 808, __pyx_L1_error)
17571  __Pyx_GOTREF(__pyx_t_16);
17572  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
17573  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
17574  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_v), __pyx_t_15, __pyx_t_16) < 0)) __PYX_ERR(0, 808, __pyx_L1_error)
17575  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
17576  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
17577  }
17578  }
17579 
17580  /* "subsurfaceTransportFunctions.pyx":803
17581  * else:
17582  * assert v.shape[2] == 2
17583  * if transient == 1: # <<<<<<<<<<<<<<
17584  * for eN in range(x.shape[0]):
17585  * for k in range(x.shape[1]):
17586  */
17587  goto __pyx_L13;
17588  }
17589 
17590  /* "subsurfaceTransportFunctions.pyx":810
17591  * v[eN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
17592  * else:
17593  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
17594  * for k in range(x.shape[1]):
17595  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17596  */
17597  /*else*/ {
17598  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
17599  __pyx_t_3 = __pyx_t_2;
17600  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
17601  __pyx_v_eN = __pyx_t_4;
17602 
17603  /* "subsurfaceTransportFunctions.pyx":811
17604  * else:
17605  * for eN in range(x.shape[0]):
17606  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
17607  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17608  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17609  */
17610  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
17611  __pyx_t_6 = __pyx_t_5;
17612  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
17613  __pyx_v_k = __pyx_t_7;
17614 
17615  /* "subsurfaceTransportFunctions.pyx":812
17616  * for eN in range(x.shape[0]):
17617  * for k in range(x.shape[1]):
17618  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc) # <<<<<<<<<<<<<<
17619  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
17620  *
17621  */
17622  __pyx_t_8 = __pyx_v_eN;
17623  __pyx_t_9 = __pyx_v_k;
17624  __pyx_t_10 = 1;
17625  __pyx_t_11 = -1;
17626  if (__pyx_t_8 < 0) {
17627  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[0].shape;
17628  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 0;
17629  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
17630  if (__pyx_t_9 < 0) {
17631  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[1].shape;
17632  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
17633  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
17634  if (__pyx_t_10 < 0) {
17635  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[2].shape;
17636  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 2;
17637  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
17638  if (unlikely(__pyx_t_11 != -1)) {
17639  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17640  __PYX_ERR(0, 812, __pyx_L1_error)
17641  }
17642  __pyx_t_12 = __pyx_v_eN;
17643  __pyx_t_13 = __pyx_v_k;
17644  __pyx_t_14 = 0;
17645  __pyx_t_11 = -1;
17646  if (__pyx_t_12 < 0) {
17647  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[0].shape;
17648  if (unlikely(__pyx_t_12 < 0)) __pyx_t_11 = 0;
17649  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17650  if (__pyx_t_13 < 0) {
17651  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[1].shape;
17652  if (unlikely(__pyx_t_13 < 0)) __pyx_t_11 = 1;
17653  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17654  if (__pyx_t_14 < 0) {
17655  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[2].shape;
17656  if (unlikely(__pyx_t_14 < 0)) __pyx_t_11 = 2;
17657  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17658  if (unlikely(__pyx_t_11 != -1)) {
17659  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17660  __PYX_ERR(0, 812, __pyx_L1_error)
17661  }
17662  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_14, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_10, __pyx_pybuffernd_x.diminfo[2].strides)) - __pyx_v_xc));
17663 
17664  /* "subsurfaceTransportFunctions.pyx":813
17665  * for k in range(x.shape[1]):
17666  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
17667  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0]) # <<<<<<<<<<<<<<
17668  *
17669  *
17670  */
17671  __pyx_t_10 = __pyx_v_eN;
17672  __pyx_t_9 = __pyx_v_k;
17673  __pyx_t_8 = 0;
17674  __pyx_t_11 = -1;
17675  if (__pyx_t_10 < 0) {
17676  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[0].shape;
17677  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 0;
17678  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
17679  if (__pyx_t_9 < 0) {
17680  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[1].shape;
17681  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
17682  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
17683  if (__pyx_t_8 < 0) {
17684  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[2].shape;
17685  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 2;
17686  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
17687  if (unlikely(__pyx_t_11 != -1)) {
17688  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17689  __PYX_ERR(0, 813, __pyx_L1_error)
17690  }
17691  __pyx_t_14 = __pyx_v_eN;
17692  __pyx_t_13 = __pyx_v_k;
17693  __pyx_t_12 = 1;
17694  __pyx_t_11 = -1;
17695  if (__pyx_t_14 < 0) {
17696  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[0].shape;
17697  if (unlikely(__pyx_t_14 < 0)) __pyx_t_11 = 0;
17698  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
17699  if (__pyx_t_13 < 0) {
17700  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[1].shape;
17701  if (unlikely(__pyx_t_13 < 0)) __pyx_t_11 = 1;
17702  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
17703  if (__pyx_t_12 < 0) {
17704  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[2].shape;
17705  if (unlikely(__pyx_t_12 < 0)) __pyx_t_11 = 2;
17706  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
17707  if (unlikely(__pyx_t_11 != -1)) {
17708  __Pyx_RaiseBufferIndexError(__pyx_t_11);
17709  __PYX_ERR(0, 813, __pyx_L1_error)
17710  }
17711  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_8, __pyx_pybuffernd_x.diminfo[2].strides))));
17712  }
17713  }
17714  }
17715  __pyx_L13:;
17716  }
17717  __pyx_L3:;
17718 
17719  /* "subsurfaceTransportFunctions.pyx":776
17720  *
17721  * #problem specific velocity evaluation
17722  * def rotatingGaussianElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
17723  * double t,
17724  * double tForReversal,
17725  */
17726 
17727  /* function exit code */
17728  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
17729  goto __pyx_L0;
17730  __pyx_L1_error:;
17731  __Pyx_XDECREF(__pyx_t_15);
17732  __Pyx_XDECREF(__pyx_t_16);
17733  __Pyx_XDECREF(__pyx_t_17);
17734  __Pyx_XDECREF(__pyx_t_20);
17735  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
17736  __Pyx_PyThreadState_declare
17737  __Pyx_PyThreadState_assign
17738  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
17739  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
17740  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
17741  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
17742  __Pyx_AddTraceback("subsurfaceTransportFunctions.rotatingGaussianElementVelocityEval3", __pyx_clineno, __pyx_lineno, __pyx_filename);
17743  __pyx_r = NULL;
17744  goto __pyx_L2;
17745  __pyx_L0:;
17746  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
17747  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
17748  __pyx_L2:;
17749  __Pyx_XGIVEREF(__pyx_r);
17750  __Pyx_RefNannyFinishContext();
17751  return __pyx_r;
17752 }
17753 
17754 /* "subsurfaceTransportFunctions.pyx":816
17755  *
17756  *
17757  * def rotatingGaussianElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
17758  * double t,
17759  * double tForReversal,
17760  */
17761 
17762 /* Python wrapper */
17763 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_49rotatingGaussianElementVelocityEval4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
17764 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_49rotatingGaussianElementVelocityEval4 = {"rotatingGaussianElementVelocityEval4", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_49rotatingGaussianElementVelocityEval4, METH_VARARGS|METH_KEYWORDS, 0};
17765 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_49rotatingGaussianElementVelocityEval4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
17766  int __pyx_v_transient;
17767  double __pyx_v_t;
17768  double __pyx_v_tForReversal;
17769  double __pyx_v_clock;
17770  double __pyx_v_xc;
17771  double __pyx_v_yc;
17772  PyArrayObject *__pyx_v_x = 0;
17773  PyArrayObject *__pyx_v_v = 0;
17774  double __pyx_v_zvelocity;
17775  int __pyx_lineno = 0;
17776  const char *__pyx_filename = NULL;
17777  int __pyx_clineno = 0;
17778  PyObject *__pyx_r = 0;
17779  __Pyx_RefNannyDeclarations
17780  __Pyx_RefNannySetupContext("rotatingGaussianElementVelocityEval4 (wrapper)", 0);
17781  {
17782  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_transient,&__pyx_n_s_t,&__pyx_n_s_tForReversal,&__pyx_n_s_clock,&__pyx_n_s_xc,&__pyx_n_s_yc,&__pyx_n_s_x,&__pyx_n_s_v,&__pyx_n_s_zvelocity,0};
17783  PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
17784  if (unlikely(__pyx_kwds)) {
17785  Py_ssize_t kw_args;
17786  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
17787  switch (pos_args) {
17788  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
17789  CYTHON_FALLTHROUGH;
17790  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
17791  CYTHON_FALLTHROUGH;
17792  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
17793  CYTHON_FALLTHROUGH;
17794  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
17795  CYTHON_FALLTHROUGH;
17796  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
17797  CYTHON_FALLTHROUGH;
17798  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
17799  CYTHON_FALLTHROUGH;
17800  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
17801  CYTHON_FALLTHROUGH;
17802  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
17803  CYTHON_FALLTHROUGH;
17804  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
17805  CYTHON_FALLTHROUGH;
17806  case 0: break;
17807  default: goto __pyx_L5_argtuple_error;
17808  }
17809  kw_args = PyDict_Size(__pyx_kwds);
17810  switch (pos_args) {
17811  case 0:
17812  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_transient)) != 0)) kw_args--;
17813  else goto __pyx_L5_argtuple_error;
17814  CYTHON_FALLTHROUGH;
17815  case 1:
17816  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
17817  else {
17818  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, 1); __PYX_ERR(0, 816, __pyx_L3_error)
17819  }
17820  CYTHON_FALLTHROUGH;
17821  case 2:
17822  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tForReversal)) != 0)) kw_args--;
17823  else {
17824  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, 2); __PYX_ERR(0, 816, __pyx_L3_error)
17825  }
17826  CYTHON_FALLTHROUGH;
17827  case 3:
17828  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_clock)) != 0)) kw_args--;
17829  else {
17830  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, 3); __PYX_ERR(0, 816, __pyx_L3_error)
17831  }
17832  CYTHON_FALLTHROUGH;
17833  case 4:
17834  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xc)) != 0)) kw_args--;
17835  else {
17836  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, 4); __PYX_ERR(0, 816, __pyx_L3_error)
17837  }
17838  CYTHON_FALLTHROUGH;
17839  case 5:
17840  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_yc)) != 0)) kw_args--;
17841  else {
17842  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, 5); __PYX_ERR(0, 816, __pyx_L3_error)
17843  }
17844  CYTHON_FALLTHROUGH;
17845  case 6:
17846  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
17847  else {
17848  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, 6); __PYX_ERR(0, 816, __pyx_L3_error)
17849  }
17850  CYTHON_FALLTHROUGH;
17851  case 7:
17852  if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
17853  else {
17854  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, 7); __PYX_ERR(0, 816, __pyx_L3_error)
17855  }
17856  CYTHON_FALLTHROUGH;
17857  case 8:
17858  if (kw_args > 0) {
17859  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_zvelocity);
17860  if (value) { values[8] = value; kw_args--; }
17861  }
17862  }
17863  if (unlikely(kw_args > 0)) {
17864  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rotatingGaussianElementVelocityEval4") < 0)) __PYX_ERR(0, 816, __pyx_L3_error)
17865  }
17866  } else {
17867  switch (PyTuple_GET_SIZE(__pyx_args)) {
17868  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
17869  CYTHON_FALLTHROUGH;
17870  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
17871  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
17872  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
17873  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
17874  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
17875  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
17876  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
17877  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
17878  break;
17879  default: goto __pyx_L5_argtuple_error;
17880  }
17881  }
17882  __pyx_v_transient = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_transient == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 816, __pyx_L3_error)
17883  __pyx_v_t = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 817, __pyx_L3_error)
17884  __pyx_v_tForReversal = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_tForReversal == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 818, __pyx_L3_error)
17885  __pyx_v_clock = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_clock == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 819, __pyx_L3_error)
17886  __pyx_v_xc = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_xc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 820, __pyx_L3_error)
17887  __pyx_v_yc = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_yc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 820, __pyx_L3_error)
17888  __pyx_v_x = ((PyArrayObject *)values[6]);
17889  __pyx_v_v = ((PyArrayObject *)values[7]);
17890  if (values[8]) {
17891  __pyx_v_zvelocity = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_zvelocity == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 823, __pyx_L3_error)
17892  } else {
17893  __pyx_v_zvelocity = ((double)0.0);
17894  }
17895  }
17896  goto __pyx_L4_argument_unpacking_done;
17897  __pyx_L5_argtuple_error:;
17898  __Pyx_RaiseArgtupleInvalid("rotatingGaussianElementVelocityEval4", 0, 8, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 816, __pyx_L3_error)
17899  __pyx_L3_error:;
17900  __Pyx_AddTraceback("subsurfaceTransportFunctions.rotatingGaussianElementVelocityEval4", __pyx_clineno, __pyx_lineno, __pyx_filename);
17901  __Pyx_RefNannyFinishContext();
17902  return NULL;
17903  __pyx_L4_argument_unpacking_done:;
17904  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 821, __pyx_L1_error)
17905  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 822, __pyx_L1_error)
17906  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_48rotatingGaussianElementVelocityEval4(__pyx_self, __pyx_v_transient, __pyx_v_t, __pyx_v_tForReversal, __pyx_v_clock, __pyx_v_xc, __pyx_v_yc, __pyx_v_x, __pyx_v_v, __pyx_v_zvelocity);
17907 
17908  /* function exit code */
17909  goto __pyx_L0;
17910  __pyx_L1_error:;
17911  __pyx_r = NULL;
17912  __pyx_L0:;
17913  __Pyx_RefNannyFinishContext();
17914  return __pyx_r;
17915 }
17916 
17917 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_48rotatingGaussianElementVelocityEval4(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v, double __pyx_v_zvelocity) {
17918  int __pyx_v_eN;
17919  int __pyx_v_ebN;
17920  int __pyx_v_k;
17921  double __pyx_v_pi;
17922  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
17923  __Pyx_Buffer __pyx_pybuffer_v;
17924  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
17925  __Pyx_Buffer __pyx_pybuffer_x;
17926  PyObject *__pyx_r = NULL;
17927  __Pyx_RefNannyDeclarations
17928  int __pyx_t_1;
17929  npy_intp __pyx_t_2;
17930  npy_intp __pyx_t_3;
17931  int __pyx_t_4;
17932  npy_intp __pyx_t_5;
17933  npy_intp __pyx_t_6;
17934  int __pyx_t_7;
17935  npy_intp __pyx_t_8;
17936  npy_intp __pyx_t_9;
17937  int __pyx_t_10;
17938  Py_ssize_t __pyx_t_11;
17939  Py_ssize_t __pyx_t_12;
17940  Py_ssize_t __pyx_t_13;
17941  Py_ssize_t __pyx_t_14;
17942  int __pyx_t_15;
17943  Py_ssize_t __pyx_t_16;
17944  Py_ssize_t __pyx_t_17;
17945  Py_ssize_t __pyx_t_18;
17946  Py_ssize_t __pyx_t_19;
17947  PyObject *__pyx_t_20 = NULL;
17948  PyObject *__pyx_t_21 = NULL;
17949  PyObject *__pyx_t_22 = NULL;
17950  PyObject *__pyx_t_23 = NULL;
17951  double __pyx_t_24;
17952  double __pyx_t_25;
17953  int __pyx_lineno = 0;
17954  const char *__pyx_filename = NULL;
17955  int __pyx_clineno = 0;
17956  __Pyx_RefNannySetupContext("rotatingGaussianElementVelocityEval4", 0);
17957  __pyx_pybuffer_x.pybuffer.buf = NULL;
17958  __pyx_pybuffer_x.refcount = 0;
17959  __pyx_pybuffernd_x.data = NULL;
17960  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
17961  __pyx_pybuffer_v.pybuffer.buf = NULL;
17962  __pyx_pybuffer_v.refcount = 0;
17963  __pyx_pybuffernd_v.data = NULL;
17964  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
17965  {
17966  __Pyx_BufFmt_StackElem __pyx_stack[1];
17967  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 816, __pyx_L1_error)
17968  }
17969  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_x.diminfo[3].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_x.diminfo[3].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[3];
17970  {
17971  __Pyx_BufFmt_StackElem __pyx_stack[1];
17972  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 816, __pyx_L1_error)
17973  }
17974  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_v.diminfo[3].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_v.diminfo[3].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[3];
17975 
17976  /* "subsurfaceTransportFunctions.pyx":826
17977  * cdef int eN,ebN,k
17978  * cdef double pi
17979  * pi = M_PI # <<<<<<<<<<<<<<
17980  * if v.shape[v.ndim-1] == 3:
17981  * if transient == 1:
17982  */
17983  __pyx_v_pi = M_PI;
17984 
17985  /* "subsurfaceTransportFunctions.pyx":827
17986  * cdef double pi
17987  * pi = M_PI
17988  * if v.shape[v.ndim-1] == 3: # <<<<<<<<<<<<<<
17989  * if transient == 1:
17990  * for eN in range(x.shape[0]):
17991  */
17992  __pyx_t_1 = (((__pyx_v_v->dimensions[(__pyx_v_v->nd - 1)]) == 3) != 0);
17993  if (__pyx_t_1) {
17994 
17995  /* "subsurfaceTransportFunctions.pyx":828
17996  * pi = M_PI
17997  * if v.shape[v.ndim-1] == 3:
17998  * if transient == 1: # <<<<<<<<<<<<<<
17999  * for eN in range(x.shape[0]):
18000  * for ebN in range(x.shape[1]):
18001  */
18002  __pyx_t_1 = ((__pyx_v_transient == 1) != 0);
18003  if (__pyx_t_1) {
18004 
18005  /* "subsurfaceTransportFunctions.pyx":829
18006  * if v.shape[v.ndim-1] == 3:
18007  * if transient == 1:
18008  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
18009  * for ebN in range(x.shape[1]):
18010  * for k in range(x.shape[2]):
18011  */
18012  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
18013  __pyx_t_3 = __pyx_t_2;
18014  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
18015  __pyx_v_eN = __pyx_t_4;
18016 
18017  /* "subsurfaceTransportFunctions.pyx":830
18018  * if transient == 1:
18019  * for eN in range(x.shape[0]):
18020  * for ebN in range(x.shape[1]): # <<<<<<<<<<<<<<
18021  * for k in range(x.shape[2]):
18022  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18023  */
18024  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
18025  __pyx_t_6 = __pyx_t_5;
18026  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
18027  __pyx_v_ebN = __pyx_t_7;
18028 
18029  /* "subsurfaceTransportFunctions.pyx":831
18030  * for eN in range(x.shape[0]):
18031  * for ebN in range(x.shape[1]):
18032  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
18033  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18034  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18035  */
18036  __pyx_t_8 = (__pyx_v_x->dimensions[2]);
18037  __pyx_t_9 = __pyx_t_8;
18038  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
18039  __pyx_v_k = __pyx_t_10;
18040 
18041  /* "subsurfaceTransportFunctions.pyx":832
18042  * for ebN in range(x.shape[1]):
18043  * for k in range(x.shape[2]):
18044  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc) # <<<<<<<<<<<<<<
18045  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18046  * v[eN,ebN,k,2]=zvelocity
18047  */
18048  __pyx_t_11 = __pyx_v_eN;
18049  __pyx_t_12 = __pyx_v_ebN;
18050  __pyx_t_13 = __pyx_v_k;
18051  __pyx_t_14 = 1;
18052  __pyx_t_15 = -1;
18053  if (__pyx_t_11 < 0) {
18054  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[0].shape;
18055  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 0;
18056  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
18057  if (__pyx_t_12 < 0) {
18058  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[1].shape;
18059  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 1;
18060  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
18061  if (__pyx_t_13 < 0) {
18062  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[2].shape;
18063  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 2;
18064  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
18065  if (__pyx_t_14 < 0) {
18066  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[3].shape;
18067  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 3;
18068  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
18069  if (unlikely(__pyx_t_15 != -1)) {
18070  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18071  __PYX_ERR(0, 832, __pyx_L1_error)
18072  }
18073  __pyx_t_16 = __pyx_v_eN;
18074  __pyx_t_17 = __pyx_v_ebN;
18075  __pyx_t_18 = __pyx_v_k;
18076  __pyx_t_19 = 0;
18077  __pyx_t_15 = -1;
18078  if (__pyx_t_16 < 0) {
18079  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[0].shape;
18080  if (unlikely(__pyx_t_16 < 0)) __pyx_t_15 = 0;
18081  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
18082  if (__pyx_t_17 < 0) {
18083  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[1].shape;
18084  if (unlikely(__pyx_t_17 < 0)) __pyx_t_15 = 1;
18085  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
18086  if (__pyx_t_18 < 0) {
18087  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[2].shape;
18088  if (unlikely(__pyx_t_18 < 0)) __pyx_t_15 = 2;
18089  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
18090  if (__pyx_t_19 < 0) {
18091  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[3].shape;
18092  if (unlikely(__pyx_t_19 < 0)) __pyx_t_15 = 3;
18093  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
18094  if (unlikely(__pyx_t_15 != -1)) {
18095  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18096  __PYX_ERR(0, 832, __pyx_L1_error)
18097  }
18098  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_19, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_14, __pyx_pybuffernd_x.diminfo[3].strides)) - __pyx_v_xc));
18099 
18100  /* "subsurfaceTransportFunctions.pyx":833
18101  * for k in range(x.shape[2]):
18102  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18103  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0]) # <<<<<<<<<<<<<<
18104  * v[eN,ebN,k,2]=zvelocity
18105  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
18106  */
18107  __pyx_t_14 = __pyx_v_eN;
18108  __pyx_t_13 = __pyx_v_ebN;
18109  __pyx_t_12 = __pyx_v_k;
18110  __pyx_t_11 = 0;
18111  __pyx_t_15 = -1;
18112  if (__pyx_t_14 < 0) {
18113  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[0].shape;
18114  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 0;
18115  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
18116  if (__pyx_t_13 < 0) {
18117  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[1].shape;
18118  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 1;
18119  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
18120  if (__pyx_t_12 < 0) {
18121  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[2].shape;
18122  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 2;
18123  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
18124  if (__pyx_t_11 < 0) {
18125  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[3].shape;
18126  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 3;
18127  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
18128  if (unlikely(__pyx_t_15 != -1)) {
18129  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18130  __PYX_ERR(0, 833, __pyx_L1_error)
18131  }
18132  __pyx_t_19 = __pyx_v_eN;
18133  __pyx_t_18 = __pyx_v_ebN;
18134  __pyx_t_17 = __pyx_v_k;
18135  __pyx_t_16 = 1;
18136  __pyx_t_15 = -1;
18137  if (__pyx_t_19 < 0) {
18138  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[0].shape;
18139  if (unlikely(__pyx_t_19 < 0)) __pyx_t_15 = 0;
18140  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
18141  if (__pyx_t_18 < 0) {
18142  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[1].shape;
18143  if (unlikely(__pyx_t_18 < 0)) __pyx_t_15 = 1;
18144  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
18145  if (__pyx_t_17 < 0) {
18146  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[2].shape;
18147  if (unlikely(__pyx_t_17 < 0)) __pyx_t_15 = 2;
18148  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
18149  if (__pyx_t_16 < 0) {
18150  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[3].shape;
18151  if (unlikely(__pyx_t_16 < 0)) __pyx_t_15 = 3;
18152  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
18153  if (unlikely(__pyx_t_15 != -1)) {
18154  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18155  __PYX_ERR(0, 833, __pyx_L1_error)
18156  }
18157  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_16, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_11, __pyx_pybuffernd_x.diminfo[3].strides))));
18158 
18159  /* "subsurfaceTransportFunctions.pyx":834
18160  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18161  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18162  * v[eN,ebN,k,2]=zvelocity # <<<<<<<<<<<<<<
18163  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
18164  * else:
18165  */
18166  __pyx_t_11 = __pyx_v_eN;
18167  __pyx_t_12 = __pyx_v_ebN;
18168  __pyx_t_13 = __pyx_v_k;
18169  __pyx_t_14 = 2;
18170  __pyx_t_15 = -1;
18171  if (__pyx_t_11 < 0) {
18172  __pyx_t_11 += __pyx_pybuffernd_v.diminfo[0].shape;
18173  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 0;
18174  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
18175  if (__pyx_t_12 < 0) {
18176  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[1].shape;
18177  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 1;
18178  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
18179  if (__pyx_t_13 < 0) {
18180  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[2].shape;
18181  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 2;
18182  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
18183  if (__pyx_t_14 < 0) {
18184  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[3].shape;
18185  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 3;
18186  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
18187  if (unlikely(__pyx_t_15 != -1)) {
18188  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18189  __PYX_ERR(0, 834, __pyx_L1_error)
18190  }
18191  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_14, __pyx_pybuffernd_v.diminfo[3].strides) = __pyx_v_zvelocity;
18192 
18193  /* "subsurfaceTransportFunctions.pyx":835
18194  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18195  * v[eN,ebN,k,2]=zvelocity
18196  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock # <<<<<<<<<<<<<<
18197  * else:
18198  * for eN in range(x.shape[0]):
18199  */
18200  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 835, __pyx_L1_error)
18201  __Pyx_GOTREF(__pyx_t_20);
18202  __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 835, __pyx_L1_error)
18203  __Pyx_GOTREF(__pyx_t_21);
18204  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 835, __pyx_L1_error)
18205  __Pyx_GOTREF(__pyx_t_22);
18206  __pyx_t_23 = PyTuple_New(4); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 835, __pyx_L1_error)
18207  __Pyx_GOTREF(__pyx_t_23);
18208  __Pyx_GIVEREF(__pyx_t_20);
18209  PyTuple_SET_ITEM(__pyx_t_23, 0, __pyx_t_20);
18210  __Pyx_GIVEREF(__pyx_t_21);
18211  PyTuple_SET_ITEM(__pyx_t_23, 1, __pyx_t_21);
18212  __Pyx_GIVEREF(__pyx_t_22);
18213  PyTuple_SET_ITEM(__pyx_t_23, 2, __pyx_t_22);
18214  __Pyx_INCREF(__pyx_slice_);
18215  __Pyx_GIVEREF(__pyx_slice_);
18216  PyTuple_SET_ITEM(__pyx_t_23, 3, __pyx_slice_);
18217  __pyx_t_20 = 0;
18218  __pyx_t_21 = 0;
18219  __pyx_t_22 = 0;
18220  __pyx_t_22 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_v), __pyx_t_23); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 835, __pyx_L1_error)
18221  __Pyx_GOTREF(__pyx_t_22);
18222  __pyx_t_24 = (__pyx_v_tForReversal - __pyx_v_t);
18223  __pyx_t_25 = (__pyx_v_tForReversal - 0.0);
18224  if (unlikely(__pyx_t_25 == 0)) {
18225  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
18226  __PYX_ERR(0, 835, __pyx_L1_error)
18227  }
18228  __pyx_t_21 = PyFloat_FromDouble(((__pyx_t_24 / __pyx_t_25) * __pyx_v_clock)); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 835, __pyx_L1_error)
18229  __Pyx_GOTREF(__pyx_t_21);
18230  __pyx_t_20 = PyNumber_InPlaceMultiply(__pyx_t_22, __pyx_t_21); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 835, __pyx_L1_error)
18231  __Pyx_GOTREF(__pyx_t_20);
18232  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
18233  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
18234  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_v), __pyx_t_23, __pyx_t_20) < 0)) __PYX_ERR(0, 835, __pyx_L1_error)
18235  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
18236  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
18237  }
18238  }
18239  }
18240 
18241  /* "subsurfaceTransportFunctions.pyx":828
18242  * pi = M_PI
18243  * if v.shape[v.ndim-1] == 3:
18244  * if transient == 1: # <<<<<<<<<<<<<<
18245  * for eN in range(x.shape[0]):
18246  * for ebN in range(x.shape[1]):
18247  */
18248  goto __pyx_L4;
18249  }
18250 
18251  /* "subsurfaceTransportFunctions.pyx":837
18252  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
18253  * else:
18254  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
18255  * for ebN in range(x.shape[1]):
18256  * for k in range(x.shape[2]):
18257  */
18258  /*else*/ {
18259  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
18260  __pyx_t_3 = __pyx_t_2;
18261  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
18262  __pyx_v_eN = __pyx_t_4;
18263 
18264  /* "subsurfaceTransportFunctions.pyx":838
18265  * else:
18266  * for eN in range(x.shape[0]):
18267  * for ebN in range(x.shape[1]): # <<<<<<<<<<<<<<
18268  * for k in range(x.shape[2]):
18269  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18270  */
18271  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
18272  __pyx_t_6 = __pyx_t_5;
18273  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
18274  __pyx_v_ebN = __pyx_t_7;
18275 
18276  /* "subsurfaceTransportFunctions.pyx":839
18277  * for eN in range(x.shape[0]):
18278  * for ebN in range(x.shape[1]):
18279  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
18280  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18281  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18282  */
18283  __pyx_t_8 = (__pyx_v_x->dimensions[2]);
18284  __pyx_t_9 = __pyx_t_8;
18285  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
18286  __pyx_v_k = __pyx_t_10;
18287 
18288  /* "subsurfaceTransportFunctions.pyx":840
18289  * for ebN in range(x.shape[1]):
18290  * for k in range(x.shape[2]):
18291  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc) # <<<<<<<<<<<<<<
18292  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18293  * v[eN,ebN,k,2]=zvelocity
18294  */
18295  __pyx_t_14 = __pyx_v_eN;
18296  __pyx_t_13 = __pyx_v_ebN;
18297  __pyx_t_12 = __pyx_v_k;
18298  __pyx_t_11 = 1;
18299  __pyx_t_15 = -1;
18300  if (__pyx_t_14 < 0) {
18301  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[0].shape;
18302  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 0;
18303  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
18304  if (__pyx_t_13 < 0) {
18305  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[1].shape;
18306  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 1;
18307  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
18308  if (__pyx_t_12 < 0) {
18309  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[2].shape;
18310  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 2;
18311  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
18312  if (__pyx_t_11 < 0) {
18313  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[3].shape;
18314  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 3;
18315  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
18316  if (unlikely(__pyx_t_15 != -1)) {
18317  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18318  __PYX_ERR(0, 840, __pyx_L1_error)
18319  }
18320  __pyx_t_16 = __pyx_v_eN;
18321  __pyx_t_17 = __pyx_v_ebN;
18322  __pyx_t_18 = __pyx_v_k;
18323  __pyx_t_19 = 0;
18324  __pyx_t_15 = -1;
18325  if (__pyx_t_16 < 0) {
18326  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[0].shape;
18327  if (unlikely(__pyx_t_16 < 0)) __pyx_t_15 = 0;
18328  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
18329  if (__pyx_t_17 < 0) {
18330  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[1].shape;
18331  if (unlikely(__pyx_t_17 < 0)) __pyx_t_15 = 1;
18332  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
18333  if (__pyx_t_18 < 0) {
18334  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[2].shape;
18335  if (unlikely(__pyx_t_18 < 0)) __pyx_t_15 = 2;
18336  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
18337  if (__pyx_t_19 < 0) {
18338  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[3].shape;
18339  if (unlikely(__pyx_t_19 < 0)) __pyx_t_15 = 3;
18340  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
18341  if (unlikely(__pyx_t_15 != -1)) {
18342  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18343  __PYX_ERR(0, 840, __pyx_L1_error)
18344  }
18345  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_19, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_11, __pyx_pybuffernd_x.diminfo[3].strides)) - __pyx_v_xc));
18346 
18347  /* "subsurfaceTransportFunctions.pyx":841
18348  * for k in range(x.shape[2]):
18349  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18350  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0]) # <<<<<<<<<<<<<<
18351  * v[eN,ebN,k,2]=zvelocity
18352  * else:
18353  */
18354  __pyx_t_11 = __pyx_v_eN;
18355  __pyx_t_12 = __pyx_v_ebN;
18356  __pyx_t_13 = __pyx_v_k;
18357  __pyx_t_14 = 0;
18358  __pyx_t_15 = -1;
18359  if (__pyx_t_11 < 0) {
18360  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[0].shape;
18361  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 0;
18362  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
18363  if (__pyx_t_12 < 0) {
18364  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[1].shape;
18365  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 1;
18366  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
18367  if (__pyx_t_13 < 0) {
18368  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[2].shape;
18369  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 2;
18370  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
18371  if (__pyx_t_14 < 0) {
18372  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[3].shape;
18373  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 3;
18374  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
18375  if (unlikely(__pyx_t_15 != -1)) {
18376  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18377  __PYX_ERR(0, 841, __pyx_L1_error)
18378  }
18379  __pyx_t_19 = __pyx_v_eN;
18380  __pyx_t_18 = __pyx_v_ebN;
18381  __pyx_t_17 = __pyx_v_k;
18382  __pyx_t_16 = 1;
18383  __pyx_t_15 = -1;
18384  if (__pyx_t_19 < 0) {
18385  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[0].shape;
18386  if (unlikely(__pyx_t_19 < 0)) __pyx_t_15 = 0;
18387  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
18388  if (__pyx_t_18 < 0) {
18389  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[1].shape;
18390  if (unlikely(__pyx_t_18 < 0)) __pyx_t_15 = 1;
18391  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
18392  if (__pyx_t_17 < 0) {
18393  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[2].shape;
18394  if (unlikely(__pyx_t_17 < 0)) __pyx_t_15 = 2;
18395  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
18396  if (__pyx_t_16 < 0) {
18397  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[3].shape;
18398  if (unlikely(__pyx_t_16 < 0)) __pyx_t_15 = 3;
18399  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
18400  if (unlikely(__pyx_t_15 != -1)) {
18401  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18402  __PYX_ERR(0, 841, __pyx_L1_error)
18403  }
18404  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_16, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_14, __pyx_pybuffernd_x.diminfo[3].strides))));
18405 
18406  /* "subsurfaceTransportFunctions.pyx":842
18407  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18408  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18409  * v[eN,ebN,k,2]=zvelocity # <<<<<<<<<<<<<<
18410  * else:
18411  * assert v.shape[v.ndim-1] == 2
18412  */
18413  __pyx_t_14 = __pyx_v_eN;
18414  __pyx_t_13 = __pyx_v_ebN;
18415  __pyx_t_12 = __pyx_v_k;
18416  __pyx_t_11 = 2;
18417  __pyx_t_15 = -1;
18418  if (__pyx_t_14 < 0) {
18419  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[0].shape;
18420  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 0;
18421  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
18422  if (__pyx_t_13 < 0) {
18423  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[1].shape;
18424  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 1;
18425  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
18426  if (__pyx_t_12 < 0) {
18427  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[2].shape;
18428  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 2;
18429  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
18430  if (__pyx_t_11 < 0) {
18431  __pyx_t_11 += __pyx_pybuffernd_v.diminfo[3].shape;
18432  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 3;
18433  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
18434  if (unlikely(__pyx_t_15 != -1)) {
18435  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18436  __PYX_ERR(0, 842, __pyx_L1_error)
18437  }
18438  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_11, __pyx_pybuffernd_v.diminfo[3].strides) = __pyx_v_zvelocity;
18439  }
18440  }
18441  }
18442  }
18443  __pyx_L4:;
18444 
18445  /* "subsurfaceTransportFunctions.pyx":827
18446  * cdef double pi
18447  * pi = M_PI
18448  * if v.shape[v.ndim-1] == 3: # <<<<<<<<<<<<<<
18449  * if transient == 1:
18450  * for eN in range(x.shape[0]):
18451  */
18452  goto __pyx_L3;
18453  }
18454 
18455  /* "subsurfaceTransportFunctions.pyx":844
18456  * v[eN,ebN,k,2]=zvelocity
18457  * else:
18458  * assert v.shape[v.ndim-1] == 2 # <<<<<<<<<<<<<<
18459  * if transient == 1:
18460  * for eN in range(x.shape[0]):
18461  */
18462  /*else*/ {
18463  #ifndef CYTHON_WITHOUT_ASSERTIONS
18464  if (unlikely(!Py_OptimizeFlag)) {
18465  if (unlikely(!(((__pyx_v_v->dimensions[(__pyx_v_v->nd - 1)]) == 2) != 0))) {
18466  PyErr_SetNone(PyExc_AssertionError);
18467  __PYX_ERR(0, 844, __pyx_L1_error)
18468  }
18469  }
18470  #endif
18471 
18472  /* "subsurfaceTransportFunctions.pyx":845
18473  * else:
18474  * assert v.shape[v.ndim-1] == 2
18475  * if transient == 1: # <<<<<<<<<<<<<<
18476  * for eN in range(x.shape[0]):
18477  * for ebN in range(x.shape[1]):
18478  */
18479  __pyx_t_1 = ((__pyx_v_transient == 1) != 0);
18480  if (__pyx_t_1) {
18481 
18482  /* "subsurfaceTransportFunctions.pyx":846
18483  * assert v.shape[v.ndim-1] == 2
18484  * if transient == 1:
18485  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
18486  * for ebN in range(x.shape[1]):
18487  * for k in range(x.shape[2]):
18488  */
18489  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
18490  __pyx_t_3 = __pyx_t_2;
18491  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
18492  __pyx_v_eN = __pyx_t_4;
18493 
18494  /* "subsurfaceTransportFunctions.pyx":847
18495  * if transient == 1:
18496  * for eN in range(x.shape[0]):
18497  * for ebN in range(x.shape[1]): # <<<<<<<<<<<<<<
18498  * for k in range(x.shape[2]):
18499  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18500  */
18501  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
18502  __pyx_t_6 = __pyx_t_5;
18503  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
18504  __pyx_v_ebN = __pyx_t_7;
18505 
18506  /* "subsurfaceTransportFunctions.pyx":848
18507  * for eN in range(x.shape[0]):
18508  * for ebN in range(x.shape[1]):
18509  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
18510  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18511  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18512  */
18513  __pyx_t_8 = (__pyx_v_x->dimensions[2]);
18514  __pyx_t_9 = __pyx_t_8;
18515  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
18516  __pyx_v_k = __pyx_t_10;
18517 
18518  /* "subsurfaceTransportFunctions.pyx":849
18519  * for ebN in range(x.shape[1]):
18520  * for k in range(x.shape[2]):
18521  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc) # <<<<<<<<<<<<<<
18522  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18523  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
18524  */
18525  __pyx_t_11 = __pyx_v_eN;
18526  __pyx_t_12 = __pyx_v_ebN;
18527  __pyx_t_13 = __pyx_v_k;
18528  __pyx_t_14 = 1;
18529  __pyx_t_15 = -1;
18530  if (__pyx_t_11 < 0) {
18531  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[0].shape;
18532  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 0;
18533  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
18534  if (__pyx_t_12 < 0) {
18535  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[1].shape;
18536  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 1;
18537  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
18538  if (__pyx_t_13 < 0) {
18539  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[2].shape;
18540  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 2;
18541  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
18542  if (__pyx_t_14 < 0) {
18543  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[3].shape;
18544  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 3;
18545  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
18546  if (unlikely(__pyx_t_15 != -1)) {
18547  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18548  __PYX_ERR(0, 849, __pyx_L1_error)
18549  }
18550  __pyx_t_16 = __pyx_v_eN;
18551  __pyx_t_17 = __pyx_v_ebN;
18552  __pyx_t_18 = __pyx_v_k;
18553  __pyx_t_19 = 0;
18554  __pyx_t_15 = -1;
18555  if (__pyx_t_16 < 0) {
18556  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[0].shape;
18557  if (unlikely(__pyx_t_16 < 0)) __pyx_t_15 = 0;
18558  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
18559  if (__pyx_t_17 < 0) {
18560  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[1].shape;
18561  if (unlikely(__pyx_t_17 < 0)) __pyx_t_15 = 1;
18562  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
18563  if (__pyx_t_18 < 0) {
18564  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[2].shape;
18565  if (unlikely(__pyx_t_18 < 0)) __pyx_t_15 = 2;
18566  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
18567  if (__pyx_t_19 < 0) {
18568  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[3].shape;
18569  if (unlikely(__pyx_t_19 < 0)) __pyx_t_15 = 3;
18570  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
18571  if (unlikely(__pyx_t_15 != -1)) {
18572  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18573  __PYX_ERR(0, 849, __pyx_L1_error)
18574  }
18575  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_19, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_14, __pyx_pybuffernd_x.diminfo[3].strides)) - __pyx_v_xc));
18576 
18577  /* "subsurfaceTransportFunctions.pyx":850
18578  * for k in range(x.shape[2]):
18579  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18580  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0]) # <<<<<<<<<<<<<<
18581  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
18582  * else:
18583  */
18584  __pyx_t_14 = __pyx_v_eN;
18585  __pyx_t_13 = __pyx_v_ebN;
18586  __pyx_t_12 = __pyx_v_k;
18587  __pyx_t_11 = 0;
18588  __pyx_t_15 = -1;
18589  if (__pyx_t_14 < 0) {
18590  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[0].shape;
18591  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 0;
18592  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
18593  if (__pyx_t_13 < 0) {
18594  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[1].shape;
18595  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 1;
18596  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
18597  if (__pyx_t_12 < 0) {
18598  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[2].shape;
18599  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 2;
18600  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
18601  if (__pyx_t_11 < 0) {
18602  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[3].shape;
18603  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 3;
18604  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
18605  if (unlikely(__pyx_t_15 != -1)) {
18606  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18607  __PYX_ERR(0, 850, __pyx_L1_error)
18608  }
18609  __pyx_t_19 = __pyx_v_eN;
18610  __pyx_t_18 = __pyx_v_ebN;
18611  __pyx_t_17 = __pyx_v_k;
18612  __pyx_t_16 = 1;
18613  __pyx_t_15 = -1;
18614  if (__pyx_t_19 < 0) {
18615  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[0].shape;
18616  if (unlikely(__pyx_t_19 < 0)) __pyx_t_15 = 0;
18617  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
18618  if (__pyx_t_18 < 0) {
18619  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[1].shape;
18620  if (unlikely(__pyx_t_18 < 0)) __pyx_t_15 = 1;
18621  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
18622  if (__pyx_t_17 < 0) {
18623  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[2].shape;
18624  if (unlikely(__pyx_t_17 < 0)) __pyx_t_15 = 2;
18625  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
18626  if (__pyx_t_16 < 0) {
18627  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[3].shape;
18628  if (unlikely(__pyx_t_16 < 0)) __pyx_t_15 = 3;
18629  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
18630  if (unlikely(__pyx_t_15 != -1)) {
18631  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18632  __PYX_ERR(0, 850, __pyx_L1_error)
18633  }
18634  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_16, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_11, __pyx_pybuffernd_x.diminfo[3].strides))));
18635 
18636  /* "subsurfaceTransportFunctions.pyx":851
18637  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18638  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18639  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock # <<<<<<<<<<<<<<
18640  * else:
18641  * for eN in range(x.shape[0]):
18642  */
18643  __pyx_t_23 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 851, __pyx_L1_error)
18644  __Pyx_GOTREF(__pyx_t_23);
18645  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 851, __pyx_L1_error)
18646  __Pyx_GOTREF(__pyx_t_20);
18647  __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 851, __pyx_L1_error)
18648  __Pyx_GOTREF(__pyx_t_21);
18649  __pyx_t_22 = PyTuple_New(4); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 851, __pyx_L1_error)
18650  __Pyx_GOTREF(__pyx_t_22);
18651  __Pyx_GIVEREF(__pyx_t_23);
18652  PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_23);
18653  __Pyx_GIVEREF(__pyx_t_20);
18654  PyTuple_SET_ITEM(__pyx_t_22, 1, __pyx_t_20);
18655  __Pyx_GIVEREF(__pyx_t_21);
18656  PyTuple_SET_ITEM(__pyx_t_22, 2, __pyx_t_21);
18657  __Pyx_INCREF(__pyx_slice_);
18658  __Pyx_GIVEREF(__pyx_slice_);
18659  PyTuple_SET_ITEM(__pyx_t_22, 3, __pyx_slice_);
18660  __pyx_t_23 = 0;
18661  __pyx_t_20 = 0;
18662  __pyx_t_21 = 0;
18663  __pyx_t_21 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_v), __pyx_t_22); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 851, __pyx_L1_error)
18664  __Pyx_GOTREF(__pyx_t_21);
18665  __pyx_t_25 = (__pyx_v_tForReversal - __pyx_v_t);
18666  __pyx_t_24 = (__pyx_v_tForReversal - 0.0);
18667  if (unlikely(__pyx_t_24 == 0)) {
18668  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
18669  __PYX_ERR(0, 851, __pyx_L1_error)
18670  }
18671  __pyx_t_20 = PyFloat_FromDouble(((__pyx_t_25 / __pyx_t_24) * __pyx_v_clock)); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 851, __pyx_L1_error)
18672  __Pyx_GOTREF(__pyx_t_20);
18673  __pyx_t_23 = PyNumber_InPlaceMultiply(__pyx_t_21, __pyx_t_20); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 851, __pyx_L1_error)
18674  __Pyx_GOTREF(__pyx_t_23);
18675  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
18676  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
18677  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_v), __pyx_t_22, __pyx_t_23) < 0)) __PYX_ERR(0, 851, __pyx_L1_error)
18678  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
18679  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
18680  }
18681  }
18682  }
18683 
18684  /* "subsurfaceTransportFunctions.pyx":845
18685  * else:
18686  * assert v.shape[v.ndim-1] == 2
18687  * if transient == 1: # <<<<<<<<<<<<<<
18688  * for eN in range(x.shape[0]):
18689  * for ebN in range(x.shape[1]):
18690  */
18691  goto __pyx_L17;
18692  }
18693 
18694  /* "subsurfaceTransportFunctions.pyx":853
18695  * v[eN,ebN,k,:]*=(tForReversal-t)/(tForReversal-0.0)*clock
18696  * else:
18697  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
18698  * for ebN in range(x.shape[1]):
18699  * for k in range(x.shape[2]):
18700  */
18701  /*else*/ {
18702  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
18703  __pyx_t_3 = __pyx_t_2;
18704  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
18705  __pyx_v_eN = __pyx_t_4;
18706 
18707  /* "subsurfaceTransportFunctions.pyx":854
18708  * else:
18709  * for eN in range(x.shape[0]):
18710  * for ebN in range(x.shape[1]): # <<<<<<<<<<<<<<
18711  * for k in range(x.shape[2]):
18712  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18713  */
18714  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
18715  __pyx_t_6 = __pyx_t_5;
18716  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
18717  __pyx_v_ebN = __pyx_t_7;
18718 
18719  /* "subsurfaceTransportFunctions.pyx":855
18720  * for eN in range(x.shape[0]):
18721  * for ebN in range(x.shape[1]):
18722  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
18723  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18724  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18725  */
18726  __pyx_t_8 = (__pyx_v_x->dimensions[2]);
18727  __pyx_t_9 = __pyx_t_8;
18728  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
18729  __pyx_v_k = __pyx_t_10;
18730 
18731  /* "subsurfaceTransportFunctions.pyx":856
18732  * for ebN in range(x.shape[1]):
18733  * for k in range(x.shape[2]):
18734  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc) # <<<<<<<<<<<<<<
18735  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18736  *
18737  */
18738  __pyx_t_11 = __pyx_v_eN;
18739  __pyx_t_12 = __pyx_v_ebN;
18740  __pyx_t_13 = __pyx_v_k;
18741  __pyx_t_14 = 1;
18742  __pyx_t_15 = -1;
18743  if (__pyx_t_11 < 0) {
18744  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[0].shape;
18745  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 0;
18746  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
18747  if (__pyx_t_12 < 0) {
18748  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[1].shape;
18749  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 1;
18750  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
18751  if (__pyx_t_13 < 0) {
18752  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[2].shape;
18753  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 2;
18754  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
18755  if (__pyx_t_14 < 0) {
18756  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[3].shape;
18757  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 3;
18758  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
18759  if (unlikely(__pyx_t_15 != -1)) {
18760  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18761  __PYX_ERR(0, 856, __pyx_L1_error)
18762  }
18763  __pyx_t_16 = __pyx_v_eN;
18764  __pyx_t_17 = __pyx_v_ebN;
18765  __pyx_t_18 = __pyx_v_k;
18766  __pyx_t_19 = 0;
18767  __pyx_t_15 = -1;
18768  if (__pyx_t_16 < 0) {
18769  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[0].shape;
18770  if (unlikely(__pyx_t_16 < 0)) __pyx_t_15 = 0;
18771  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
18772  if (__pyx_t_17 < 0) {
18773  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[1].shape;
18774  if (unlikely(__pyx_t_17 < 0)) __pyx_t_15 = 1;
18775  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
18776  if (__pyx_t_18 < 0) {
18777  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[2].shape;
18778  if (unlikely(__pyx_t_18 < 0)) __pyx_t_15 = 2;
18779  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
18780  if (__pyx_t_19 < 0) {
18781  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[3].shape;
18782  if (unlikely(__pyx_t_19 < 0)) __pyx_t_15 = 3;
18783  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
18784  if (unlikely(__pyx_t_15 != -1)) {
18785  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18786  __PYX_ERR(0, 856, __pyx_L1_error)
18787  }
18788  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_19, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_14, __pyx_pybuffernd_x.diminfo[3].strides)) - __pyx_v_xc));
18789 
18790  /* "subsurfaceTransportFunctions.pyx":857
18791  * for k in range(x.shape[2]):
18792  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
18793  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0]) # <<<<<<<<<<<<<<
18794  *
18795  * def helicalElementVelocityEval3(int transient,
18796  */
18797  __pyx_t_14 = __pyx_v_eN;
18798  __pyx_t_13 = __pyx_v_ebN;
18799  __pyx_t_12 = __pyx_v_k;
18800  __pyx_t_11 = 0;
18801  __pyx_t_15 = -1;
18802  if (__pyx_t_14 < 0) {
18803  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[0].shape;
18804  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 0;
18805  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
18806  if (__pyx_t_13 < 0) {
18807  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[1].shape;
18808  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 1;
18809  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
18810  if (__pyx_t_12 < 0) {
18811  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[2].shape;
18812  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 2;
18813  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
18814  if (__pyx_t_11 < 0) {
18815  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[3].shape;
18816  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 3;
18817  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
18818  if (unlikely(__pyx_t_15 != -1)) {
18819  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18820  __PYX_ERR(0, 857, __pyx_L1_error)
18821  }
18822  __pyx_t_19 = __pyx_v_eN;
18823  __pyx_t_18 = __pyx_v_ebN;
18824  __pyx_t_17 = __pyx_v_k;
18825  __pyx_t_16 = 1;
18826  __pyx_t_15 = -1;
18827  if (__pyx_t_19 < 0) {
18828  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[0].shape;
18829  if (unlikely(__pyx_t_19 < 0)) __pyx_t_15 = 0;
18830  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
18831  if (__pyx_t_18 < 0) {
18832  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[1].shape;
18833  if (unlikely(__pyx_t_18 < 0)) __pyx_t_15 = 1;
18834  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
18835  if (__pyx_t_17 < 0) {
18836  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[2].shape;
18837  if (unlikely(__pyx_t_17 < 0)) __pyx_t_15 = 2;
18838  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
18839  if (__pyx_t_16 < 0) {
18840  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[3].shape;
18841  if (unlikely(__pyx_t_16 < 0)) __pyx_t_15 = 3;
18842  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
18843  if (unlikely(__pyx_t_15 != -1)) {
18844  __Pyx_RaiseBufferIndexError(__pyx_t_15);
18845  __PYX_ERR(0, 857, __pyx_L1_error)
18846  }
18847  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_16, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_11, __pyx_pybuffernd_x.diminfo[3].strides))));
18848  }
18849  }
18850  }
18851  }
18852  __pyx_L17:;
18853  }
18854  __pyx_L3:;
18855 
18856  /* "subsurfaceTransportFunctions.pyx":816
18857  *
18858  *
18859  * def rotatingGaussianElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
18860  * double t,
18861  * double tForReversal,
18862  */
18863 
18864  /* function exit code */
18865  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
18866  goto __pyx_L0;
18867  __pyx_L1_error:;
18868  __Pyx_XDECREF(__pyx_t_20);
18869  __Pyx_XDECREF(__pyx_t_21);
18870  __Pyx_XDECREF(__pyx_t_22);
18871  __Pyx_XDECREF(__pyx_t_23);
18872  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
18873  __Pyx_PyThreadState_declare
18874  __Pyx_PyThreadState_assign
18875  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
18876  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
18877  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
18878  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
18879  __Pyx_AddTraceback("subsurfaceTransportFunctions.rotatingGaussianElementVelocityEval4", __pyx_clineno, __pyx_lineno, __pyx_filename);
18880  __pyx_r = NULL;
18881  goto __pyx_L2;
18882  __pyx_L0:;
18883  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
18884  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
18885  __pyx_L2:;
18886  __Pyx_XGIVEREF(__pyx_r);
18887  __Pyx_RefNannyFinishContext();
18888  return __pyx_r;
18889 }
18890 
18891 /* "subsurfaceTransportFunctions.pyx":859
18892  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
18893  *
18894  * def helicalElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
18895  * double t,
18896  * double tForReversal,
18897  */
18898 
18899 /* Python wrapper */
18900 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_51helicalElementVelocityEval3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
18901 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_51helicalElementVelocityEval3 = {"helicalElementVelocityEval3", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_51helicalElementVelocityEval3, METH_VARARGS|METH_KEYWORDS, 0};
18902 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_51helicalElementVelocityEval3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
18903  int __pyx_v_transient;
18904  double __pyx_v_t;
18905  double __pyx_v_tForReversal;
18906  double __pyx_v_clock;
18907  double __pyx_v_zVelocity;
18908  double __pyx_v_xc;
18909  double __pyx_v_yc;
18910  PyArrayObject *__pyx_v_x = 0;
18911  PyArrayObject *__pyx_v_v = 0;
18912  int __pyx_lineno = 0;
18913  const char *__pyx_filename = NULL;
18914  int __pyx_clineno = 0;
18915  PyObject *__pyx_r = 0;
18916  __Pyx_RefNannyDeclarations
18917  __Pyx_RefNannySetupContext("helicalElementVelocityEval3 (wrapper)", 0);
18918  {
18919  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_transient,&__pyx_n_s_t,&__pyx_n_s_tForReversal,&__pyx_n_s_clock,&__pyx_n_s_zVelocity,&__pyx_n_s_xc,&__pyx_n_s_yc,&__pyx_n_s_x,&__pyx_n_s_v,0};
18920  PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
18921  if (unlikely(__pyx_kwds)) {
18922  Py_ssize_t kw_args;
18923  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
18924  switch (pos_args) {
18925  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
18926  CYTHON_FALLTHROUGH;
18927  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
18928  CYTHON_FALLTHROUGH;
18929  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
18930  CYTHON_FALLTHROUGH;
18931  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
18932  CYTHON_FALLTHROUGH;
18933  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
18934  CYTHON_FALLTHROUGH;
18935  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
18936  CYTHON_FALLTHROUGH;
18937  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
18938  CYTHON_FALLTHROUGH;
18939  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
18940  CYTHON_FALLTHROUGH;
18941  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
18942  CYTHON_FALLTHROUGH;
18943  case 0: break;
18944  default: goto __pyx_L5_argtuple_error;
18945  }
18946  kw_args = PyDict_Size(__pyx_kwds);
18947  switch (pos_args) {
18948  case 0:
18949  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_transient)) != 0)) kw_args--;
18950  else goto __pyx_L5_argtuple_error;
18951  CYTHON_FALLTHROUGH;
18952  case 1:
18953  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
18954  else {
18955  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 1); __PYX_ERR(0, 859, __pyx_L3_error)
18956  }
18957  CYTHON_FALLTHROUGH;
18958  case 2:
18959  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tForReversal)) != 0)) kw_args--;
18960  else {
18961  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 2); __PYX_ERR(0, 859, __pyx_L3_error)
18962  }
18963  CYTHON_FALLTHROUGH;
18964  case 3:
18965  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_clock)) != 0)) kw_args--;
18966  else {
18967  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 3); __PYX_ERR(0, 859, __pyx_L3_error)
18968  }
18969  CYTHON_FALLTHROUGH;
18970  case 4:
18971  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_zVelocity)) != 0)) kw_args--;
18972  else {
18973  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 4); __PYX_ERR(0, 859, __pyx_L3_error)
18974  }
18975  CYTHON_FALLTHROUGH;
18976  case 5:
18977  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xc)) != 0)) kw_args--;
18978  else {
18979  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 5); __PYX_ERR(0, 859, __pyx_L3_error)
18980  }
18981  CYTHON_FALLTHROUGH;
18982  case 6:
18983  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_yc)) != 0)) kw_args--;
18984  else {
18985  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 6); __PYX_ERR(0, 859, __pyx_L3_error)
18986  }
18987  CYTHON_FALLTHROUGH;
18988  case 7:
18989  if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
18990  else {
18991  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 7); __PYX_ERR(0, 859, __pyx_L3_error)
18992  }
18993  CYTHON_FALLTHROUGH;
18994  case 8:
18995  if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
18996  else {
18997  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, 8); __PYX_ERR(0, 859, __pyx_L3_error)
18998  }
18999  }
19000  if (unlikely(kw_args > 0)) {
19001  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "helicalElementVelocityEval3") < 0)) __PYX_ERR(0, 859, __pyx_L3_error)
19002  }
19003  } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
19004  goto __pyx_L5_argtuple_error;
19005  } else {
19006  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
19007  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
19008  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
19009  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
19010  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
19011  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
19012  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
19013  values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
19014  values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
19015  }
19016  __pyx_v_transient = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_transient == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 859, __pyx_L3_error)
19017  __pyx_v_t = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 860, __pyx_L3_error)
19018  __pyx_v_tForReversal = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_tForReversal == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 861, __pyx_L3_error)
19019  __pyx_v_clock = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_clock == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 862, __pyx_L3_error)
19020  __pyx_v_zVelocity = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_zVelocity == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 863, __pyx_L3_error)
19021  __pyx_v_xc = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_xc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 864, __pyx_L3_error)
19022  __pyx_v_yc = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_yc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 864, __pyx_L3_error)
19023  __pyx_v_x = ((PyArrayObject *)values[7]);
19024  __pyx_v_v = ((PyArrayObject *)values[8]);
19025  }
19026  goto __pyx_L4_argument_unpacking_done;
19027  __pyx_L5_argtuple_error:;
19028  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval3", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 859, __pyx_L3_error)
19029  __pyx_L3_error:;
19030  __Pyx_AddTraceback("subsurfaceTransportFunctions.helicalElementVelocityEval3", __pyx_clineno, __pyx_lineno, __pyx_filename);
19031  __Pyx_RefNannyFinishContext();
19032  return NULL;
19033  __pyx_L4_argument_unpacking_done:;
19034  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 865, __pyx_L1_error)
19035  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 866, __pyx_L1_error)
19036  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_50helicalElementVelocityEval3(__pyx_self, __pyx_v_transient, __pyx_v_t, __pyx_v_tForReversal, __pyx_v_clock, __pyx_v_zVelocity, __pyx_v_xc, __pyx_v_yc, __pyx_v_x, __pyx_v_v);
19037 
19038  /* function exit code */
19039  goto __pyx_L0;
19040  __pyx_L1_error:;
19041  __pyx_r = NULL;
19042  __pyx_L0:;
19043  __Pyx_RefNannyFinishContext();
19044  return __pyx_r;
19045 }
19046 
19047 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_50helicalElementVelocityEval3(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_zVelocity, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v) {
19048  int __pyx_v_eN;
19049  int __pyx_v_k;
19050  double __pyx_v_pi;
19051  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
19052  __Pyx_Buffer __pyx_pybuffer_v;
19053  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
19054  __Pyx_Buffer __pyx_pybuffer_x;
19055  PyObject *__pyx_r = NULL;
19056  __Pyx_RefNannyDeclarations
19057  int __pyx_t_1;
19058  npy_intp __pyx_t_2;
19059  npy_intp __pyx_t_3;
19060  int __pyx_t_4;
19061  npy_intp __pyx_t_5;
19062  npy_intp __pyx_t_6;
19063  int __pyx_t_7;
19064  Py_ssize_t __pyx_t_8;
19065  Py_ssize_t __pyx_t_9;
19066  Py_ssize_t __pyx_t_10;
19067  int __pyx_t_11;
19068  Py_ssize_t __pyx_t_12;
19069  Py_ssize_t __pyx_t_13;
19070  Py_ssize_t __pyx_t_14;
19071  PyObject *__pyx_t_15 = NULL;
19072  PyObject *__pyx_t_16 = NULL;
19073  PyObject *__pyx_t_17 = NULL;
19074  double __pyx_t_18;
19075  double __pyx_t_19;
19076  PyObject *__pyx_t_20 = NULL;
19077  int __pyx_lineno = 0;
19078  const char *__pyx_filename = NULL;
19079  int __pyx_clineno = 0;
19080  __Pyx_RefNannySetupContext("helicalElementVelocityEval3", 0);
19081  __pyx_pybuffer_x.pybuffer.buf = NULL;
19082  __pyx_pybuffer_x.refcount = 0;
19083  __pyx_pybuffernd_x.data = NULL;
19084  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
19085  __pyx_pybuffer_v.pybuffer.buf = NULL;
19086  __pyx_pybuffer_v.refcount = 0;
19087  __pyx_pybuffernd_v.data = NULL;
19088  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
19089  {
19090  __Pyx_BufFmt_StackElem __pyx_stack[1];
19091  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 859, __pyx_L1_error)
19092  }
19093  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2];
19094  {
19095  __Pyx_BufFmt_StackElem __pyx_stack[1];
19096  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 859, __pyx_L1_error)
19097  }
19098  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2];
19099 
19100  /* "subsurfaceTransportFunctions.pyx":869
19101  * cdef int eN,k
19102  * cdef double pi
19103  * pi = M_PI # <<<<<<<<<<<<<<
19104  * if transient == 1:
19105  * for eN in range(x.shape[0]):
19106  */
19107  __pyx_v_pi = M_PI;
19108 
19109  /* "subsurfaceTransportFunctions.pyx":870
19110  * cdef double pi
19111  * pi = M_PI
19112  * if transient == 1: # <<<<<<<<<<<<<<
19113  * for eN in range(x.shape[0]):
19114  * for k in range(x.shape[1]):
19115  */
19116  __pyx_t_1 = ((__pyx_v_transient == 1) != 0);
19117  if (__pyx_t_1) {
19118 
19119  /* "subsurfaceTransportFunctions.pyx":871
19120  * pi = M_PI
19121  * if transient == 1:
19122  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
19123  * for k in range(x.shape[1]):
19124  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
19125  */
19126  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
19127  __pyx_t_3 = __pyx_t_2;
19128  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
19129  __pyx_v_eN = __pyx_t_4;
19130 
19131  /* "subsurfaceTransportFunctions.pyx":872
19132  * if transient == 1:
19133  * for eN in range(x.shape[0]):
19134  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
19135  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
19136  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
19137  */
19138  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
19139  __pyx_t_6 = __pyx_t_5;
19140  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
19141  __pyx_v_k = __pyx_t_7;
19142 
19143  /* "subsurfaceTransportFunctions.pyx":873
19144  * for eN in range(x.shape[0]):
19145  * for k in range(x.shape[1]):
19146  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc) # <<<<<<<<<<<<<<
19147  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
19148  * v[eN,k,2]=zVelocity
19149  */
19150  __pyx_t_8 = __pyx_v_eN;
19151  __pyx_t_9 = __pyx_v_k;
19152  __pyx_t_10 = 1;
19153  __pyx_t_11 = -1;
19154  if (__pyx_t_8 < 0) {
19155  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[0].shape;
19156  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 0;
19157  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
19158  if (__pyx_t_9 < 0) {
19159  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[1].shape;
19160  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
19161  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
19162  if (__pyx_t_10 < 0) {
19163  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[2].shape;
19164  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 2;
19165  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
19166  if (unlikely(__pyx_t_11 != -1)) {
19167  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19168  __PYX_ERR(0, 873, __pyx_L1_error)
19169  }
19170  __pyx_t_12 = __pyx_v_eN;
19171  __pyx_t_13 = __pyx_v_k;
19172  __pyx_t_14 = 0;
19173  __pyx_t_11 = -1;
19174  if (__pyx_t_12 < 0) {
19175  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[0].shape;
19176  if (unlikely(__pyx_t_12 < 0)) __pyx_t_11 = 0;
19177  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
19178  if (__pyx_t_13 < 0) {
19179  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[1].shape;
19180  if (unlikely(__pyx_t_13 < 0)) __pyx_t_11 = 1;
19181  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
19182  if (__pyx_t_14 < 0) {
19183  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[2].shape;
19184  if (unlikely(__pyx_t_14 < 0)) __pyx_t_11 = 2;
19185  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
19186  if (unlikely(__pyx_t_11 != -1)) {
19187  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19188  __PYX_ERR(0, 873, __pyx_L1_error)
19189  }
19190  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_14, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_10, __pyx_pybuffernd_x.diminfo[2].strides)) - __pyx_v_xc));
19191 
19192  /* "subsurfaceTransportFunctions.pyx":874
19193  * for k in range(x.shape[1]):
19194  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
19195  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0]) # <<<<<<<<<<<<<<
19196  * v[eN,k,2]=zVelocity
19197  * v[eN,k,:]*=clock*cos(pi*t/(tForReversal*2.0))
19198  */
19199  __pyx_t_10 = __pyx_v_eN;
19200  __pyx_t_9 = __pyx_v_k;
19201  __pyx_t_8 = 0;
19202  __pyx_t_11 = -1;
19203  if (__pyx_t_10 < 0) {
19204  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[0].shape;
19205  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 0;
19206  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
19207  if (__pyx_t_9 < 0) {
19208  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[1].shape;
19209  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
19210  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
19211  if (__pyx_t_8 < 0) {
19212  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[2].shape;
19213  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 2;
19214  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
19215  if (unlikely(__pyx_t_11 != -1)) {
19216  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19217  __PYX_ERR(0, 874, __pyx_L1_error)
19218  }
19219  __pyx_t_14 = __pyx_v_eN;
19220  __pyx_t_13 = __pyx_v_k;
19221  __pyx_t_12 = 1;
19222  __pyx_t_11 = -1;
19223  if (__pyx_t_14 < 0) {
19224  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[0].shape;
19225  if (unlikely(__pyx_t_14 < 0)) __pyx_t_11 = 0;
19226  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
19227  if (__pyx_t_13 < 0) {
19228  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[1].shape;
19229  if (unlikely(__pyx_t_13 < 0)) __pyx_t_11 = 1;
19230  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
19231  if (__pyx_t_12 < 0) {
19232  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[2].shape;
19233  if (unlikely(__pyx_t_12 < 0)) __pyx_t_11 = 2;
19234  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
19235  if (unlikely(__pyx_t_11 != -1)) {
19236  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19237  __PYX_ERR(0, 874, __pyx_L1_error)
19238  }
19239  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_8, __pyx_pybuffernd_x.diminfo[2].strides))));
19240 
19241  /* "subsurfaceTransportFunctions.pyx":875
19242  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
19243  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
19244  * v[eN,k,2]=zVelocity # <<<<<<<<<<<<<<
19245  * v[eN,k,:]*=clock*cos(pi*t/(tForReversal*2.0))
19246  * else:
19247  */
19248  __pyx_t_8 = __pyx_v_eN;
19249  __pyx_t_9 = __pyx_v_k;
19250  __pyx_t_10 = 2;
19251  __pyx_t_11 = -1;
19252  if (__pyx_t_8 < 0) {
19253  __pyx_t_8 += __pyx_pybuffernd_v.diminfo[0].shape;
19254  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 0;
19255  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
19256  if (__pyx_t_9 < 0) {
19257  __pyx_t_9 += __pyx_pybuffernd_v.diminfo[1].shape;
19258  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
19259  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
19260  if (__pyx_t_10 < 0) {
19261  __pyx_t_10 += __pyx_pybuffernd_v.diminfo[2].shape;
19262  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 2;
19263  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
19264  if (unlikely(__pyx_t_11 != -1)) {
19265  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19266  __PYX_ERR(0, 875, __pyx_L1_error)
19267  }
19268  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_10, __pyx_pybuffernd_v.diminfo[2].strides) = __pyx_v_zVelocity;
19269 
19270  /* "subsurfaceTransportFunctions.pyx":876
19271  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
19272  * v[eN,k,2]=zVelocity
19273  * v[eN,k,:]*=clock*cos(pi*t/(tForReversal*2.0)) # <<<<<<<<<<<<<<
19274  * else:
19275  * for eN in range(x.shape[0]):
19276  */
19277  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 876, __pyx_L1_error)
19278  __Pyx_GOTREF(__pyx_t_15);
19279  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 876, __pyx_L1_error)
19280  __Pyx_GOTREF(__pyx_t_16);
19281  __pyx_t_17 = PyTuple_New(3); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 876, __pyx_L1_error)
19282  __Pyx_GOTREF(__pyx_t_17);
19283  __Pyx_GIVEREF(__pyx_t_15);
19284  PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_15);
19285  __Pyx_GIVEREF(__pyx_t_16);
19286  PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_16);
19287  __Pyx_INCREF(__pyx_slice_);
19288  __Pyx_GIVEREF(__pyx_slice_);
19289  PyTuple_SET_ITEM(__pyx_t_17, 2, __pyx_slice_);
19290  __pyx_t_15 = 0;
19291  __pyx_t_16 = 0;
19292  __pyx_t_16 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_v), __pyx_t_17); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 876, __pyx_L1_error)
19293  __Pyx_GOTREF(__pyx_t_16);
19294  __pyx_t_18 = (__pyx_v_pi * __pyx_v_t);
19295  __pyx_t_19 = (__pyx_v_tForReversal * 2.0);
19296  if (unlikely(__pyx_t_19 == 0)) {
19297  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
19298  __PYX_ERR(0, 876, __pyx_L1_error)
19299  }
19300  __pyx_t_15 = PyFloat_FromDouble((__pyx_v_clock * cos((__pyx_t_18 / __pyx_t_19)))); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 876, __pyx_L1_error)
19301  __Pyx_GOTREF(__pyx_t_15);
19302  __pyx_t_20 = PyNumber_InPlaceMultiply(__pyx_t_16, __pyx_t_15); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 876, __pyx_L1_error)
19303  __Pyx_GOTREF(__pyx_t_20);
19304  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
19305  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
19306  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_v), __pyx_t_17, __pyx_t_20) < 0)) __PYX_ERR(0, 876, __pyx_L1_error)
19307  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
19308  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
19309  }
19310  }
19311 
19312  /* "subsurfaceTransportFunctions.pyx":870
19313  * cdef double pi
19314  * pi = M_PI
19315  * if transient == 1: # <<<<<<<<<<<<<<
19316  * for eN in range(x.shape[0]):
19317  * for k in range(x.shape[1]):
19318  */
19319  goto __pyx_L3;
19320  }
19321 
19322  /* "subsurfaceTransportFunctions.pyx":878
19323  * v[eN,k,:]*=clock*cos(pi*t/(tForReversal*2.0))
19324  * else:
19325  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
19326  * for k in range(x.shape[1]):
19327  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
19328  */
19329  /*else*/ {
19330  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
19331  __pyx_t_3 = __pyx_t_2;
19332  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
19333  __pyx_v_eN = __pyx_t_4;
19334 
19335  /* "subsurfaceTransportFunctions.pyx":879
19336  * else:
19337  * for eN in range(x.shape[0]):
19338  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
19339  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
19340  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
19341  */
19342  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
19343  __pyx_t_6 = __pyx_t_5;
19344  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
19345  __pyx_v_k = __pyx_t_7;
19346 
19347  /* "subsurfaceTransportFunctions.pyx":880
19348  * for eN in range(x.shape[0]):
19349  * for k in range(x.shape[1]):
19350  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc) # <<<<<<<<<<<<<<
19351  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
19352  * v[eN,k,2]=zVelocity
19353  */
19354  __pyx_t_10 = __pyx_v_eN;
19355  __pyx_t_9 = __pyx_v_k;
19356  __pyx_t_8 = 1;
19357  __pyx_t_11 = -1;
19358  if (__pyx_t_10 < 0) {
19359  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[0].shape;
19360  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 0;
19361  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
19362  if (__pyx_t_9 < 0) {
19363  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[1].shape;
19364  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
19365  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
19366  if (__pyx_t_8 < 0) {
19367  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[2].shape;
19368  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 2;
19369  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
19370  if (unlikely(__pyx_t_11 != -1)) {
19371  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19372  __PYX_ERR(0, 880, __pyx_L1_error)
19373  }
19374  __pyx_t_12 = __pyx_v_eN;
19375  __pyx_t_13 = __pyx_v_k;
19376  __pyx_t_14 = 0;
19377  __pyx_t_11 = -1;
19378  if (__pyx_t_12 < 0) {
19379  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[0].shape;
19380  if (unlikely(__pyx_t_12 < 0)) __pyx_t_11 = 0;
19381  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
19382  if (__pyx_t_13 < 0) {
19383  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[1].shape;
19384  if (unlikely(__pyx_t_13 < 0)) __pyx_t_11 = 1;
19385  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
19386  if (__pyx_t_14 < 0) {
19387  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[2].shape;
19388  if (unlikely(__pyx_t_14 < 0)) __pyx_t_11 = 2;
19389  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
19390  if (unlikely(__pyx_t_11 != -1)) {
19391  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19392  __PYX_ERR(0, 880, __pyx_L1_error)
19393  }
19394  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_14, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_8, __pyx_pybuffernd_x.diminfo[2].strides)) - __pyx_v_xc));
19395 
19396  /* "subsurfaceTransportFunctions.pyx":881
19397  * for k in range(x.shape[1]):
19398  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
19399  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0]) # <<<<<<<<<<<<<<
19400  * v[eN,k,2]=zVelocity
19401  *
19402  */
19403  __pyx_t_8 = __pyx_v_eN;
19404  __pyx_t_9 = __pyx_v_k;
19405  __pyx_t_10 = 0;
19406  __pyx_t_11 = -1;
19407  if (__pyx_t_8 < 0) {
19408  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[0].shape;
19409  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 0;
19410  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_11 = 0;
19411  if (__pyx_t_9 < 0) {
19412  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[1].shape;
19413  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
19414  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_11 = 1;
19415  if (__pyx_t_10 < 0) {
19416  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[2].shape;
19417  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 2;
19418  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_11 = 2;
19419  if (unlikely(__pyx_t_11 != -1)) {
19420  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19421  __PYX_ERR(0, 881, __pyx_L1_error)
19422  }
19423  __pyx_t_14 = __pyx_v_eN;
19424  __pyx_t_13 = __pyx_v_k;
19425  __pyx_t_12 = 1;
19426  __pyx_t_11 = -1;
19427  if (__pyx_t_14 < 0) {
19428  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[0].shape;
19429  if (unlikely(__pyx_t_14 < 0)) __pyx_t_11 = 0;
19430  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
19431  if (__pyx_t_13 < 0) {
19432  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[1].shape;
19433  if (unlikely(__pyx_t_13 < 0)) __pyx_t_11 = 1;
19434  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
19435  if (__pyx_t_12 < 0) {
19436  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[2].shape;
19437  if (unlikely(__pyx_t_12 < 0)) __pyx_t_11 = 2;
19438  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
19439  if (unlikely(__pyx_t_11 != -1)) {
19440  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19441  __PYX_ERR(0, 881, __pyx_L1_error)
19442  }
19443  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_v.diminfo[2].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_10, __pyx_pybuffernd_x.diminfo[2].strides))));
19444 
19445  /* "subsurfaceTransportFunctions.pyx":882
19446  * v[eN,k,0]=2.0*pi*(x[eN,k,1]-xc)
19447  * v[eN,k,1]=2.0*pi*(yc-x[eN,k,0])
19448  * v[eN,k,2]=zVelocity # <<<<<<<<<<<<<<
19449  *
19450  * def helicalElementVelocityEval4(int transient,
19451  */
19452  __pyx_t_10 = __pyx_v_eN;
19453  __pyx_t_9 = __pyx_v_k;
19454  __pyx_t_8 = 2;
19455  __pyx_t_11 = -1;
19456  if (__pyx_t_10 < 0) {
19457  __pyx_t_10 += __pyx_pybuffernd_v.diminfo[0].shape;
19458  if (unlikely(__pyx_t_10 < 0)) __pyx_t_11 = 0;
19459  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_11 = 0;
19460  if (__pyx_t_9 < 0) {
19461  __pyx_t_9 += __pyx_pybuffernd_v.diminfo[1].shape;
19462  if (unlikely(__pyx_t_9 < 0)) __pyx_t_11 = 1;
19463  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_11 = 1;
19464  if (__pyx_t_8 < 0) {
19465  __pyx_t_8 += __pyx_pybuffernd_v.diminfo[2].shape;
19466  if (unlikely(__pyx_t_8 < 0)) __pyx_t_11 = 2;
19467  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_11 = 2;
19468  if (unlikely(__pyx_t_11 != -1)) {
19469  __Pyx_RaiseBufferIndexError(__pyx_t_11);
19470  __PYX_ERR(0, 882, __pyx_L1_error)
19471  }
19472  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_8, __pyx_pybuffernd_v.diminfo[2].strides) = __pyx_v_zVelocity;
19473  }
19474  }
19475  }
19476  __pyx_L3:;
19477 
19478  /* "subsurfaceTransportFunctions.pyx":859
19479  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
19480  *
19481  * def helicalElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
19482  * double t,
19483  * double tForReversal,
19484  */
19485 
19486  /* function exit code */
19487  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
19488  goto __pyx_L0;
19489  __pyx_L1_error:;
19490  __Pyx_XDECREF(__pyx_t_15);
19491  __Pyx_XDECREF(__pyx_t_16);
19492  __Pyx_XDECREF(__pyx_t_17);
19493  __Pyx_XDECREF(__pyx_t_20);
19494  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
19495  __Pyx_PyThreadState_declare
19496  __Pyx_PyThreadState_assign
19497  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
19498  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
19499  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
19500  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
19501  __Pyx_AddTraceback("subsurfaceTransportFunctions.helicalElementVelocityEval3", __pyx_clineno, __pyx_lineno, __pyx_filename);
19502  __pyx_r = NULL;
19503  goto __pyx_L2;
19504  __pyx_L0:;
19505  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
19506  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
19507  __pyx_L2:;
19508  __Pyx_XGIVEREF(__pyx_r);
19509  __Pyx_RefNannyFinishContext();
19510  return __pyx_r;
19511 }
19512 
19513 /* "subsurfaceTransportFunctions.pyx":884
19514  * v[eN,k,2]=zVelocity
19515  *
19516  * def helicalElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
19517  * double t,
19518  * double tForReversal,
19519  */
19520 
19521 /* Python wrapper */
19522 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_53helicalElementVelocityEval4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
19523 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_53helicalElementVelocityEval4 = {"helicalElementVelocityEval4", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_53helicalElementVelocityEval4, METH_VARARGS|METH_KEYWORDS, 0};
19524 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_53helicalElementVelocityEval4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
19525  int __pyx_v_transient;
19526  double __pyx_v_t;
19527  double __pyx_v_tForReversal;
19528  double __pyx_v_clock;
19529  double __pyx_v_zVelocity;
19530  double __pyx_v_xc;
19531  double __pyx_v_yc;
19532  PyArrayObject *__pyx_v_x = 0;
19533  PyArrayObject *__pyx_v_v = 0;
19534  int __pyx_lineno = 0;
19535  const char *__pyx_filename = NULL;
19536  int __pyx_clineno = 0;
19537  PyObject *__pyx_r = 0;
19538  __Pyx_RefNannyDeclarations
19539  __Pyx_RefNannySetupContext("helicalElementVelocityEval4 (wrapper)", 0);
19540  {
19541  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_transient,&__pyx_n_s_t,&__pyx_n_s_tForReversal,&__pyx_n_s_clock,&__pyx_n_s_zVelocity,&__pyx_n_s_xc,&__pyx_n_s_yc,&__pyx_n_s_x,&__pyx_n_s_v,0};
19542  PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
19543  if (unlikely(__pyx_kwds)) {
19544  Py_ssize_t kw_args;
19545  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
19546  switch (pos_args) {
19547  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
19548  CYTHON_FALLTHROUGH;
19549  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
19550  CYTHON_FALLTHROUGH;
19551  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
19552  CYTHON_FALLTHROUGH;
19553  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
19554  CYTHON_FALLTHROUGH;
19555  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
19556  CYTHON_FALLTHROUGH;
19557  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
19558  CYTHON_FALLTHROUGH;
19559  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
19560  CYTHON_FALLTHROUGH;
19561  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
19562  CYTHON_FALLTHROUGH;
19563  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
19564  CYTHON_FALLTHROUGH;
19565  case 0: break;
19566  default: goto __pyx_L5_argtuple_error;
19567  }
19568  kw_args = PyDict_Size(__pyx_kwds);
19569  switch (pos_args) {
19570  case 0:
19571  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_transient)) != 0)) kw_args--;
19572  else goto __pyx_L5_argtuple_error;
19573  CYTHON_FALLTHROUGH;
19574  case 1:
19575  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
19576  else {
19577  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 1); __PYX_ERR(0, 884, __pyx_L3_error)
19578  }
19579  CYTHON_FALLTHROUGH;
19580  case 2:
19581  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tForReversal)) != 0)) kw_args--;
19582  else {
19583  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 2); __PYX_ERR(0, 884, __pyx_L3_error)
19584  }
19585  CYTHON_FALLTHROUGH;
19586  case 3:
19587  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_clock)) != 0)) kw_args--;
19588  else {
19589  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 3); __PYX_ERR(0, 884, __pyx_L3_error)
19590  }
19591  CYTHON_FALLTHROUGH;
19592  case 4:
19593  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_zVelocity)) != 0)) kw_args--;
19594  else {
19595  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 4); __PYX_ERR(0, 884, __pyx_L3_error)
19596  }
19597  CYTHON_FALLTHROUGH;
19598  case 5:
19599  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xc)) != 0)) kw_args--;
19600  else {
19601  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 5); __PYX_ERR(0, 884, __pyx_L3_error)
19602  }
19603  CYTHON_FALLTHROUGH;
19604  case 6:
19605  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_yc)) != 0)) kw_args--;
19606  else {
19607  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 6); __PYX_ERR(0, 884, __pyx_L3_error)
19608  }
19609  CYTHON_FALLTHROUGH;
19610  case 7:
19611  if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
19612  else {
19613  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 7); __PYX_ERR(0, 884, __pyx_L3_error)
19614  }
19615  CYTHON_FALLTHROUGH;
19616  case 8:
19617  if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
19618  else {
19619  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, 8); __PYX_ERR(0, 884, __pyx_L3_error)
19620  }
19621  }
19622  if (unlikely(kw_args > 0)) {
19623  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "helicalElementVelocityEval4") < 0)) __PYX_ERR(0, 884, __pyx_L3_error)
19624  }
19625  } else if (PyTuple_GET_SIZE(__pyx_args) != 9) {
19626  goto __pyx_L5_argtuple_error;
19627  } else {
19628  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
19629  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
19630  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
19631  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
19632  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
19633  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
19634  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
19635  values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
19636  values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
19637  }
19638  __pyx_v_transient = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_transient == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 884, __pyx_L3_error)
19639  __pyx_v_t = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 885, __pyx_L3_error)
19640  __pyx_v_tForReversal = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_tForReversal == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 886, __pyx_L3_error)
19641  __pyx_v_clock = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_clock == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 887, __pyx_L3_error)
19642  __pyx_v_zVelocity = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_zVelocity == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 888, __pyx_L3_error)
19643  __pyx_v_xc = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_xc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 889, __pyx_L3_error)
19644  __pyx_v_yc = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_yc == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 889, __pyx_L3_error)
19645  __pyx_v_x = ((PyArrayObject *)values[7]);
19646  __pyx_v_v = ((PyArrayObject *)values[8]);
19647  }
19648  goto __pyx_L4_argument_unpacking_done;
19649  __pyx_L5_argtuple_error:;
19650  __Pyx_RaiseArgtupleInvalid("helicalElementVelocityEval4", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 884, __pyx_L3_error)
19651  __pyx_L3_error:;
19652  __Pyx_AddTraceback("subsurfaceTransportFunctions.helicalElementVelocityEval4", __pyx_clineno, __pyx_lineno, __pyx_filename);
19653  __Pyx_RefNannyFinishContext();
19654  return NULL;
19655  __pyx_L4_argument_unpacking_done:;
19656  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 890, __pyx_L1_error)
19657  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 891, __pyx_L1_error)
19658  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_52helicalElementVelocityEval4(__pyx_self, __pyx_v_transient, __pyx_v_t, __pyx_v_tForReversal, __pyx_v_clock, __pyx_v_zVelocity, __pyx_v_xc, __pyx_v_yc, __pyx_v_x, __pyx_v_v);
19659 
19660  /* function exit code */
19661  goto __pyx_L0;
19662  __pyx_L1_error:;
19663  __pyx_r = NULL;
19664  __pyx_L0:;
19665  __Pyx_RefNannyFinishContext();
19666  return __pyx_r;
19667 }
19668 
19669 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_52helicalElementVelocityEval4(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_transient, double __pyx_v_t, double __pyx_v_tForReversal, double __pyx_v_clock, double __pyx_v_zVelocity, double __pyx_v_xc, double __pyx_v_yc, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v) {
19670  int __pyx_v_eN;
19671  int __pyx_v_ebN;
19672  int __pyx_v_k;
19673  double __pyx_v_pi;
19674  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
19675  __Pyx_Buffer __pyx_pybuffer_v;
19676  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
19677  __Pyx_Buffer __pyx_pybuffer_x;
19678  PyObject *__pyx_r = NULL;
19679  __Pyx_RefNannyDeclarations
19680  int __pyx_t_1;
19681  npy_intp __pyx_t_2;
19682  npy_intp __pyx_t_3;
19683  int __pyx_t_4;
19684  npy_intp __pyx_t_5;
19685  npy_intp __pyx_t_6;
19686  int __pyx_t_7;
19687  npy_intp __pyx_t_8;
19688  npy_intp __pyx_t_9;
19689  int __pyx_t_10;
19690  Py_ssize_t __pyx_t_11;
19691  Py_ssize_t __pyx_t_12;
19692  Py_ssize_t __pyx_t_13;
19693  Py_ssize_t __pyx_t_14;
19694  int __pyx_t_15;
19695  Py_ssize_t __pyx_t_16;
19696  Py_ssize_t __pyx_t_17;
19697  Py_ssize_t __pyx_t_18;
19698  Py_ssize_t __pyx_t_19;
19699  PyObject *__pyx_t_20 = NULL;
19700  PyObject *__pyx_t_21 = NULL;
19701  PyObject *__pyx_t_22 = NULL;
19702  PyObject *__pyx_t_23 = NULL;
19703  double __pyx_t_24;
19704  double __pyx_t_25;
19705  int __pyx_lineno = 0;
19706  const char *__pyx_filename = NULL;
19707  int __pyx_clineno = 0;
19708  __Pyx_RefNannySetupContext("helicalElementVelocityEval4", 0);
19709  __pyx_pybuffer_x.pybuffer.buf = NULL;
19710  __pyx_pybuffer_x.refcount = 0;
19711  __pyx_pybuffernd_x.data = NULL;
19712  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
19713  __pyx_pybuffer_v.pybuffer.buf = NULL;
19714  __pyx_pybuffer_v.refcount = 0;
19715  __pyx_pybuffernd_v.data = NULL;
19716  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
19717  {
19718  __Pyx_BufFmt_StackElem __pyx_stack[1];
19719  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 884, __pyx_L1_error)
19720  }
19721  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_x.diminfo[3].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_x.diminfo[3].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[3];
19722  {
19723  __Pyx_BufFmt_StackElem __pyx_stack[1];
19724  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 884, __pyx_L1_error)
19725  }
19726  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_v.diminfo[3].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_v.diminfo[3].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[3];
19727 
19728  /* "subsurfaceTransportFunctions.pyx":894
19729  * cdef int eN,ebN,k
19730  * cdef double pi
19731  * pi = M_PI # <<<<<<<<<<<<<<
19732  * if transient == 1:
19733  * for eN in range(x.shape[0]):
19734  */
19735  __pyx_v_pi = M_PI;
19736 
19737  /* "subsurfaceTransportFunctions.pyx":895
19738  * cdef double pi
19739  * pi = M_PI
19740  * if transient == 1: # <<<<<<<<<<<<<<
19741  * for eN in range(x.shape[0]):
19742  * for ebN in range(x.shape[1]):
19743  */
19744  __pyx_t_1 = ((__pyx_v_transient == 1) != 0);
19745  if (__pyx_t_1) {
19746 
19747  /* "subsurfaceTransportFunctions.pyx":896
19748  * pi = M_PI
19749  * if transient == 1:
19750  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
19751  * for ebN in range(x.shape[1]):
19752  * for k in range(x.shape[2]):
19753  */
19754  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
19755  __pyx_t_3 = __pyx_t_2;
19756  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
19757  __pyx_v_eN = __pyx_t_4;
19758 
19759  /* "subsurfaceTransportFunctions.pyx":897
19760  * if transient == 1:
19761  * for eN in range(x.shape[0]):
19762  * for ebN in range(x.shape[1]): # <<<<<<<<<<<<<<
19763  * for k in range(x.shape[2]):
19764  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
19765  */
19766  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
19767  __pyx_t_6 = __pyx_t_5;
19768  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
19769  __pyx_v_ebN = __pyx_t_7;
19770 
19771  /* "subsurfaceTransportFunctions.pyx":898
19772  * for eN in range(x.shape[0]):
19773  * for ebN in range(x.shape[1]):
19774  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
19775  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
19776  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
19777  */
19778  __pyx_t_8 = (__pyx_v_x->dimensions[2]);
19779  __pyx_t_9 = __pyx_t_8;
19780  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
19781  __pyx_v_k = __pyx_t_10;
19782 
19783  /* "subsurfaceTransportFunctions.pyx":899
19784  * for ebN in range(x.shape[1]):
19785  * for k in range(x.shape[2]):
19786  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc) # <<<<<<<<<<<<<<
19787  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
19788  * v[eN,ebN,k,2]=zVelocity
19789  */
19790  __pyx_t_11 = __pyx_v_eN;
19791  __pyx_t_12 = __pyx_v_ebN;
19792  __pyx_t_13 = __pyx_v_k;
19793  __pyx_t_14 = 1;
19794  __pyx_t_15 = -1;
19795  if (__pyx_t_11 < 0) {
19796  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[0].shape;
19797  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 0;
19798  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
19799  if (__pyx_t_12 < 0) {
19800  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[1].shape;
19801  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 1;
19802  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
19803  if (__pyx_t_13 < 0) {
19804  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[2].shape;
19805  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 2;
19806  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
19807  if (__pyx_t_14 < 0) {
19808  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[3].shape;
19809  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 3;
19810  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
19811  if (unlikely(__pyx_t_15 != -1)) {
19812  __Pyx_RaiseBufferIndexError(__pyx_t_15);
19813  __PYX_ERR(0, 899, __pyx_L1_error)
19814  }
19815  __pyx_t_16 = __pyx_v_eN;
19816  __pyx_t_17 = __pyx_v_ebN;
19817  __pyx_t_18 = __pyx_v_k;
19818  __pyx_t_19 = 0;
19819  __pyx_t_15 = -1;
19820  if (__pyx_t_16 < 0) {
19821  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[0].shape;
19822  if (unlikely(__pyx_t_16 < 0)) __pyx_t_15 = 0;
19823  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
19824  if (__pyx_t_17 < 0) {
19825  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[1].shape;
19826  if (unlikely(__pyx_t_17 < 0)) __pyx_t_15 = 1;
19827  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
19828  if (__pyx_t_18 < 0) {
19829  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[2].shape;
19830  if (unlikely(__pyx_t_18 < 0)) __pyx_t_15 = 2;
19831  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
19832  if (__pyx_t_19 < 0) {
19833  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[3].shape;
19834  if (unlikely(__pyx_t_19 < 0)) __pyx_t_15 = 3;
19835  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
19836  if (unlikely(__pyx_t_15 != -1)) {
19837  __Pyx_RaiseBufferIndexError(__pyx_t_15);
19838  __PYX_ERR(0, 899, __pyx_L1_error)
19839  }
19840  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_19, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_14, __pyx_pybuffernd_x.diminfo[3].strides)) - __pyx_v_xc));
19841 
19842  /* "subsurfaceTransportFunctions.pyx":900
19843  * for k in range(x.shape[2]):
19844  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
19845  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0]) # <<<<<<<<<<<<<<
19846  * v[eN,ebN,k,2]=zVelocity
19847  * v[eN,ebN,k,:]*=clock*cos(pi*t/(tForReversal*2.0))
19848  */
19849  __pyx_t_14 = __pyx_v_eN;
19850  __pyx_t_13 = __pyx_v_ebN;
19851  __pyx_t_12 = __pyx_v_k;
19852  __pyx_t_11 = 0;
19853  __pyx_t_15 = -1;
19854  if (__pyx_t_14 < 0) {
19855  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[0].shape;
19856  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 0;
19857  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
19858  if (__pyx_t_13 < 0) {
19859  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[1].shape;
19860  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 1;
19861  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
19862  if (__pyx_t_12 < 0) {
19863  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[2].shape;
19864  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 2;
19865  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
19866  if (__pyx_t_11 < 0) {
19867  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[3].shape;
19868  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 3;
19869  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
19870  if (unlikely(__pyx_t_15 != -1)) {
19871  __Pyx_RaiseBufferIndexError(__pyx_t_15);
19872  __PYX_ERR(0, 900, __pyx_L1_error)
19873  }
19874  __pyx_t_19 = __pyx_v_eN;
19875  __pyx_t_18 = __pyx_v_ebN;
19876  __pyx_t_17 = __pyx_v_k;
19877  __pyx_t_16 = 1;
19878  __pyx_t_15 = -1;
19879  if (__pyx_t_19 < 0) {
19880  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[0].shape;
19881  if (unlikely(__pyx_t_19 < 0)) __pyx_t_15 = 0;
19882  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
19883  if (__pyx_t_18 < 0) {
19884  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[1].shape;
19885  if (unlikely(__pyx_t_18 < 0)) __pyx_t_15 = 1;
19886  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
19887  if (__pyx_t_17 < 0) {
19888  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[2].shape;
19889  if (unlikely(__pyx_t_17 < 0)) __pyx_t_15 = 2;
19890  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
19891  if (__pyx_t_16 < 0) {
19892  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[3].shape;
19893  if (unlikely(__pyx_t_16 < 0)) __pyx_t_15 = 3;
19894  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
19895  if (unlikely(__pyx_t_15 != -1)) {
19896  __Pyx_RaiseBufferIndexError(__pyx_t_15);
19897  __PYX_ERR(0, 900, __pyx_L1_error)
19898  }
19899  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_16, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_11, __pyx_pybuffernd_x.diminfo[3].strides))));
19900 
19901  /* "subsurfaceTransportFunctions.pyx":901
19902  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
19903  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
19904  * v[eN,ebN,k,2]=zVelocity # <<<<<<<<<<<<<<
19905  * v[eN,ebN,k,:]*=clock*cos(pi*t/(tForReversal*2.0))
19906  * else:
19907  */
19908  __pyx_t_11 = __pyx_v_eN;
19909  __pyx_t_12 = __pyx_v_ebN;
19910  __pyx_t_13 = __pyx_v_k;
19911  __pyx_t_14 = 2;
19912  __pyx_t_15 = -1;
19913  if (__pyx_t_11 < 0) {
19914  __pyx_t_11 += __pyx_pybuffernd_v.diminfo[0].shape;
19915  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 0;
19916  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
19917  if (__pyx_t_12 < 0) {
19918  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[1].shape;
19919  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 1;
19920  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
19921  if (__pyx_t_13 < 0) {
19922  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[2].shape;
19923  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 2;
19924  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
19925  if (__pyx_t_14 < 0) {
19926  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[3].shape;
19927  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 3;
19928  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
19929  if (unlikely(__pyx_t_15 != -1)) {
19930  __Pyx_RaiseBufferIndexError(__pyx_t_15);
19931  __PYX_ERR(0, 901, __pyx_L1_error)
19932  }
19933  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_14, __pyx_pybuffernd_v.diminfo[3].strides) = __pyx_v_zVelocity;
19934 
19935  /* "subsurfaceTransportFunctions.pyx":902
19936  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
19937  * v[eN,ebN,k,2]=zVelocity
19938  * v[eN,ebN,k,:]*=clock*cos(pi*t/(tForReversal*2.0)) # <<<<<<<<<<<<<<
19939  * else:
19940  * for eN in range(x.shape[0]):
19941  */
19942  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 902, __pyx_L1_error)
19943  __Pyx_GOTREF(__pyx_t_20);
19944  __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_ebN); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 902, __pyx_L1_error)
19945  __Pyx_GOTREF(__pyx_t_21);
19946  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_k); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 902, __pyx_L1_error)
19947  __Pyx_GOTREF(__pyx_t_22);
19948  __pyx_t_23 = PyTuple_New(4); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 902, __pyx_L1_error)
19949  __Pyx_GOTREF(__pyx_t_23);
19950  __Pyx_GIVEREF(__pyx_t_20);
19951  PyTuple_SET_ITEM(__pyx_t_23, 0, __pyx_t_20);
19952  __Pyx_GIVEREF(__pyx_t_21);
19953  PyTuple_SET_ITEM(__pyx_t_23, 1, __pyx_t_21);
19954  __Pyx_GIVEREF(__pyx_t_22);
19955  PyTuple_SET_ITEM(__pyx_t_23, 2, __pyx_t_22);
19956  __Pyx_INCREF(__pyx_slice_);
19957  __Pyx_GIVEREF(__pyx_slice_);
19958  PyTuple_SET_ITEM(__pyx_t_23, 3, __pyx_slice_);
19959  __pyx_t_20 = 0;
19960  __pyx_t_21 = 0;
19961  __pyx_t_22 = 0;
19962  __pyx_t_22 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_v), __pyx_t_23); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 902, __pyx_L1_error)
19963  __Pyx_GOTREF(__pyx_t_22);
19964  __pyx_t_24 = (__pyx_v_pi * __pyx_v_t);
19965  __pyx_t_25 = (__pyx_v_tForReversal * 2.0);
19966  if (unlikely(__pyx_t_25 == 0)) {
19967  PyErr_SetString(PyExc_ZeroDivisionError, "float division");
19968  __PYX_ERR(0, 902, __pyx_L1_error)
19969  }
19970  __pyx_t_21 = PyFloat_FromDouble((__pyx_v_clock * cos((__pyx_t_24 / __pyx_t_25)))); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 902, __pyx_L1_error)
19971  __Pyx_GOTREF(__pyx_t_21);
19972  __pyx_t_20 = PyNumber_InPlaceMultiply(__pyx_t_22, __pyx_t_21); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 902, __pyx_L1_error)
19973  __Pyx_GOTREF(__pyx_t_20);
19974  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
19975  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
19976  if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_v), __pyx_t_23, __pyx_t_20) < 0)) __PYX_ERR(0, 902, __pyx_L1_error)
19977  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
19978  __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
19979  }
19980  }
19981  }
19982 
19983  /* "subsurfaceTransportFunctions.pyx":895
19984  * cdef double pi
19985  * pi = M_PI
19986  * if transient == 1: # <<<<<<<<<<<<<<
19987  * for eN in range(x.shape[0]):
19988  * for ebN in range(x.shape[1]):
19989  */
19990  goto __pyx_L3;
19991  }
19992 
19993  /* "subsurfaceTransportFunctions.pyx":904
19994  * v[eN,ebN,k,:]*=clock*cos(pi*t/(tForReversal*2.0))
19995  * else:
19996  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
19997  * for ebN in range(x.shape[1]):
19998  * for k in range(x.shape[2]):
19999  */
20000  /*else*/ {
20001  __pyx_t_2 = (__pyx_v_x->dimensions[0]);
20002  __pyx_t_3 = __pyx_t_2;
20003  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
20004  __pyx_v_eN = __pyx_t_4;
20005 
20006  /* "subsurfaceTransportFunctions.pyx":905
20007  * else:
20008  * for eN in range(x.shape[0]):
20009  * for ebN in range(x.shape[1]): # <<<<<<<<<<<<<<
20010  * for k in range(x.shape[2]):
20011  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
20012  */
20013  __pyx_t_5 = (__pyx_v_x->dimensions[1]);
20014  __pyx_t_6 = __pyx_t_5;
20015  for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
20016  __pyx_v_ebN = __pyx_t_7;
20017 
20018  /* "subsurfaceTransportFunctions.pyx":906
20019  * for eN in range(x.shape[0]):
20020  * for ebN in range(x.shape[1]):
20021  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
20022  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
20023  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
20024  */
20025  __pyx_t_8 = (__pyx_v_x->dimensions[2]);
20026  __pyx_t_9 = __pyx_t_8;
20027  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
20028  __pyx_v_k = __pyx_t_10;
20029 
20030  /* "subsurfaceTransportFunctions.pyx":907
20031  * for ebN in range(x.shape[1]):
20032  * for k in range(x.shape[2]):
20033  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc) # <<<<<<<<<<<<<<
20034  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
20035  * v[eN,ebN,k,2]=zVelocity
20036  */
20037  __pyx_t_14 = __pyx_v_eN;
20038  __pyx_t_13 = __pyx_v_ebN;
20039  __pyx_t_12 = __pyx_v_k;
20040  __pyx_t_11 = 1;
20041  __pyx_t_15 = -1;
20042  if (__pyx_t_14 < 0) {
20043  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[0].shape;
20044  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 0;
20045  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
20046  if (__pyx_t_13 < 0) {
20047  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[1].shape;
20048  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 1;
20049  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
20050  if (__pyx_t_12 < 0) {
20051  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[2].shape;
20052  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 2;
20053  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
20054  if (__pyx_t_11 < 0) {
20055  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[3].shape;
20056  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 3;
20057  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
20058  if (unlikely(__pyx_t_15 != -1)) {
20059  __Pyx_RaiseBufferIndexError(__pyx_t_15);
20060  __PYX_ERR(0, 907, __pyx_L1_error)
20061  }
20062  __pyx_t_16 = __pyx_v_eN;
20063  __pyx_t_17 = __pyx_v_ebN;
20064  __pyx_t_18 = __pyx_v_k;
20065  __pyx_t_19 = 0;
20066  __pyx_t_15 = -1;
20067  if (__pyx_t_16 < 0) {
20068  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[0].shape;
20069  if (unlikely(__pyx_t_16 < 0)) __pyx_t_15 = 0;
20070  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
20071  if (__pyx_t_17 < 0) {
20072  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[1].shape;
20073  if (unlikely(__pyx_t_17 < 0)) __pyx_t_15 = 1;
20074  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
20075  if (__pyx_t_18 < 0) {
20076  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[2].shape;
20077  if (unlikely(__pyx_t_18 < 0)) __pyx_t_15 = 2;
20078  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
20079  if (__pyx_t_19 < 0) {
20080  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[3].shape;
20081  if (unlikely(__pyx_t_19 < 0)) __pyx_t_15 = 3;
20082  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
20083  if (unlikely(__pyx_t_15 != -1)) {
20084  __Pyx_RaiseBufferIndexError(__pyx_t_15);
20085  __PYX_ERR(0, 907, __pyx_L1_error)
20086  }
20087  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_19, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * ((*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_11, __pyx_pybuffernd_x.diminfo[3].strides)) - __pyx_v_xc));
20088 
20089  /* "subsurfaceTransportFunctions.pyx":908
20090  * for k in range(x.shape[2]):
20091  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
20092  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0]) # <<<<<<<<<<<<<<
20093  * v[eN,ebN,k,2]=zVelocity
20094  *
20095  */
20096  __pyx_t_11 = __pyx_v_eN;
20097  __pyx_t_12 = __pyx_v_ebN;
20098  __pyx_t_13 = __pyx_v_k;
20099  __pyx_t_14 = 0;
20100  __pyx_t_15 = -1;
20101  if (__pyx_t_11 < 0) {
20102  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[0].shape;
20103  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 0;
20104  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_15 = 0;
20105  if (__pyx_t_12 < 0) {
20106  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[1].shape;
20107  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 1;
20108  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_15 = 1;
20109  if (__pyx_t_13 < 0) {
20110  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[2].shape;
20111  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 2;
20112  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_15 = 2;
20113  if (__pyx_t_14 < 0) {
20114  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[3].shape;
20115  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 3;
20116  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_15 = 3;
20117  if (unlikely(__pyx_t_15 != -1)) {
20118  __Pyx_RaiseBufferIndexError(__pyx_t_15);
20119  __PYX_ERR(0, 908, __pyx_L1_error)
20120  }
20121  __pyx_t_19 = __pyx_v_eN;
20122  __pyx_t_18 = __pyx_v_ebN;
20123  __pyx_t_17 = __pyx_v_k;
20124  __pyx_t_16 = 1;
20125  __pyx_t_15 = -1;
20126  if (__pyx_t_19 < 0) {
20127  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[0].shape;
20128  if (unlikely(__pyx_t_19 < 0)) __pyx_t_15 = 0;
20129  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
20130  if (__pyx_t_18 < 0) {
20131  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[1].shape;
20132  if (unlikely(__pyx_t_18 < 0)) __pyx_t_15 = 1;
20133  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
20134  if (__pyx_t_17 < 0) {
20135  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[2].shape;
20136  if (unlikely(__pyx_t_17 < 0)) __pyx_t_15 = 2;
20137  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
20138  if (__pyx_t_16 < 0) {
20139  __pyx_t_16 += __pyx_pybuffernd_v.diminfo[3].shape;
20140  if (unlikely(__pyx_t_16 < 0)) __pyx_t_15 = 3;
20141  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
20142  if (unlikely(__pyx_t_15 != -1)) {
20143  __Pyx_RaiseBufferIndexError(__pyx_t_15);
20144  __PYX_ERR(0, 908, __pyx_L1_error)
20145  }
20146  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_16, __pyx_pybuffernd_v.diminfo[3].strides) = ((2.0 * __pyx_v_pi) * (__pyx_v_yc - (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_14, __pyx_pybuffernd_x.diminfo[3].strides))));
20147 
20148  /* "subsurfaceTransportFunctions.pyx":909
20149  * v[eN,ebN,k,0]=2.0*pi*(x[eN,ebN,k,1]-xc)
20150  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
20151  * v[eN,ebN,k,2]=zVelocity # <<<<<<<<<<<<<<
20152  *
20153  * def vortexElementVelocityEval3(double t,
20154  */
20155  __pyx_t_14 = __pyx_v_eN;
20156  __pyx_t_13 = __pyx_v_ebN;
20157  __pyx_t_12 = __pyx_v_k;
20158  __pyx_t_11 = 2;
20159  __pyx_t_15 = -1;
20160  if (__pyx_t_14 < 0) {
20161  __pyx_t_14 += __pyx_pybuffernd_v.diminfo[0].shape;
20162  if (unlikely(__pyx_t_14 < 0)) __pyx_t_15 = 0;
20163  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_15 = 0;
20164  if (__pyx_t_13 < 0) {
20165  __pyx_t_13 += __pyx_pybuffernd_v.diminfo[1].shape;
20166  if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 1;
20167  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_15 = 1;
20168  if (__pyx_t_12 < 0) {
20169  __pyx_t_12 += __pyx_pybuffernd_v.diminfo[2].shape;
20170  if (unlikely(__pyx_t_12 < 0)) __pyx_t_15 = 2;
20171  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_15 = 2;
20172  if (__pyx_t_11 < 0) {
20173  __pyx_t_11 += __pyx_pybuffernd_v.diminfo[3].shape;
20174  if (unlikely(__pyx_t_11 < 0)) __pyx_t_15 = 3;
20175  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_15 = 3;
20176  if (unlikely(__pyx_t_15 != -1)) {
20177  __Pyx_RaiseBufferIndexError(__pyx_t_15);
20178  __PYX_ERR(0, 909, __pyx_L1_error)
20179  }
20180  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_11, __pyx_pybuffernd_v.diminfo[3].strides) = __pyx_v_zVelocity;
20181  }
20182  }
20183  }
20184  }
20185  __pyx_L3:;
20186 
20187  /* "subsurfaceTransportFunctions.pyx":884
20188  * v[eN,k,2]=zVelocity
20189  *
20190  * def helicalElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
20191  * double t,
20192  * double tForReversal,
20193  */
20194 
20195  /* function exit code */
20196  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
20197  goto __pyx_L0;
20198  __pyx_L1_error:;
20199  __Pyx_XDECREF(__pyx_t_20);
20200  __Pyx_XDECREF(__pyx_t_21);
20201  __Pyx_XDECREF(__pyx_t_22);
20202  __Pyx_XDECREF(__pyx_t_23);
20203  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
20204  __Pyx_PyThreadState_declare
20205  __Pyx_PyThreadState_assign
20206  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
20207  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
20208  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
20209  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
20210  __Pyx_AddTraceback("subsurfaceTransportFunctions.helicalElementVelocityEval4", __pyx_clineno, __pyx_lineno, __pyx_filename);
20211  __pyx_r = NULL;
20212  goto __pyx_L2;
20213  __pyx_L0:;
20214  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
20215  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
20216  __pyx_L2:;
20217  __Pyx_XGIVEREF(__pyx_r);
20218  __Pyx_RefNannyFinishContext();
20219  return __pyx_r;
20220 }
20221 
20222 /* "subsurfaceTransportFunctions.pyx":911
20223  * v[eN,ebN,k,2]=zVelocity
20224  *
20225  * def vortexElementVelocityEval3(double t, # <<<<<<<<<<<<<<
20226  * numpy.ndarray[DTYPE_t,ndim=3] x,
20227  * numpy.ndarray[DTYPE_t,ndim=3] v):
20228  */
20229 
20230 /* Python wrapper */
20231 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_55vortexElementVelocityEval3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
20232 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_55vortexElementVelocityEval3 = {"vortexElementVelocityEval3", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_55vortexElementVelocityEval3, METH_VARARGS|METH_KEYWORDS, 0};
20233 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_55vortexElementVelocityEval3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
20234  double __pyx_v_t;
20235  PyArrayObject *__pyx_v_x = 0;
20236  PyArrayObject *__pyx_v_v = 0;
20237  int __pyx_lineno = 0;
20238  const char *__pyx_filename = NULL;
20239  int __pyx_clineno = 0;
20240  PyObject *__pyx_r = 0;
20241  __Pyx_RefNannyDeclarations
20242  __Pyx_RefNannySetupContext("vortexElementVelocityEval3 (wrapper)", 0);
20243  {
20244  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_x,&__pyx_n_s_v,0};
20245  PyObject* values[3] = {0,0,0};
20246  if (unlikely(__pyx_kwds)) {
20247  Py_ssize_t kw_args;
20248  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
20249  switch (pos_args) {
20250  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
20251  CYTHON_FALLTHROUGH;
20252  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
20253  CYTHON_FALLTHROUGH;
20254  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
20255  CYTHON_FALLTHROUGH;
20256  case 0: break;
20257  default: goto __pyx_L5_argtuple_error;
20258  }
20259  kw_args = PyDict_Size(__pyx_kwds);
20260  switch (pos_args) {
20261  case 0:
20262  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
20263  else goto __pyx_L5_argtuple_error;
20264  CYTHON_FALLTHROUGH;
20265  case 1:
20266  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
20267  else {
20268  __Pyx_RaiseArgtupleInvalid("vortexElementVelocityEval3", 1, 3, 3, 1); __PYX_ERR(0, 911, __pyx_L3_error)
20269  }
20270  CYTHON_FALLTHROUGH;
20271  case 2:
20272  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
20273  else {
20274  __Pyx_RaiseArgtupleInvalid("vortexElementVelocityEval3", 1, 3, 3, 2); __PYX_ERR(0, 911, __pyx_L3_error)
20275  }
20276  }
20277  if (unlikely(kw_args > 0)) {
20278  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "vortexElementVelocityEval3") < 0)) __PYX_ERR(0, 911, __pyx_L3_error)
20279  }
20280  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
20281  goto __pyx_L5_argtuple_error;
20282  } else {
20283  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
20284  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
20285  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
20286  }
20287  __pyx_v_t = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 911, __pyx_L3_error)
20288  __pyx_v_x = ((PyArrayObject *)values[1]);
20289  __pyx_v_v = ((PyArrayObject *)values[2]);
20290  }
20291  goto __pyx_L4_argument_unpacking_done;
20292  __pyx_L5_argtuple_error:;
20293  __Pyx_RaiseArgtupleInvalid("vortexElementVelocityEval3", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 911, __pyx_L3_error)
20294  __pyx_L3_error:;
20295  __Pyx_AddTraceback("subsurfaceTransportFunctions.vortexElementVelocityEval3", __pyx_clineno, __pyx_lineno, __pyx_filename);
20296  __Pyx_RefNannyFinishContext();
20297  return NULL;
20298  __pyx_L4_argument_unpacking_done:;
20299  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 912, __pyx_L1_error)
20300  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 913, __pyx_L1_error)
20301  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_54vortexElementVelocityEval3(__pyx_self, __pyx_v_t, __pyx_v_x, __pyx_v_v);
20302 
20303  /* function exit code */
20304  goto __pyx_L0;
20305  __pyx_L1_error:;
20306  __pyx_r = NULL;
20307  __pyx_L0:;
20308  __Pyx_RefNannyFinishContext();
20309  return __pyx_r;
20310 }
20311 
20312 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_54vortexElementVelocityEval3(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v) {
20313  int __pyx_v_eN;
20314  int __pyx_v_k;
20315  double __pyx_v_pi;
20316  double __pyx_v_one8;
20317  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
20318  __Pyx_Buffer __pyx_pybuffer_v;
20319  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
20320  __Pyx_Buffer __pyx_pybuffer_x;
20321  PyObject *__pyx_r = NULL;
20322  __Pyx_RefNannyDeclarations
20323  npy_intp __pyx_t_1;
20324  npy_intp __pyx_t_2;
20325  int __pyx_t_3;
20326  npy_intp __pyx_t_4;
20327  npy_intp __pyx_t_5;
20328  int __pyx_t_6;
20329  Py_ssize_t __pyx_t_7;
20330  Py_ssize_t __pyx_t_8;
20331  Py_ssize_t __pyx_t_9;
20332  int __pyx_t_10;
20333  Py_ssize_t __pyx_t_11;
20334  Py_ssize_t __pyx_t_12;
20335  Py_ssize_t __pyx_t_13;
20336  Py_ssize_t __pyx_t_14;
20337  Py_ssize_t __pyx_t_15;
20338  Py_ssize_t __pyx_t_16;
20339  Py_ssize_t __pyx_t_17;
20340  Py_ssize_t __pyx_t_18;
20341  Py_ssize_t __pyx_t_19;
20342  int __pyx_lineno = 0;
20343  const char *__pyx_filename = NULL;
20344  int __pyx_clineno = 0;
20345  __Pyx_RefNannySetupContext("vortexElementVelocityEval3", 0);
20346  __pyx_pybuffer_x.pybuffer.buf = NULL;
20347  __pyx_pybuffer_x.refcount = 0;
20348  __pyx_pybuffernd_x.data = NULL;
20349  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
20350  __pyx_pybuffer_v.pybuffer.buf = NULL;
20351  __pyx_pybuffer_v.refcount = 0;
20352  __pyx_pybuffernd_v.data = NULL;
20353  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
20354  {
20355  __Pyx_BufFmt_StackElem __pyx_stack[1];
20356  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 911, __pyx_L1_error)
20357  }
20358  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2];
20359  {
20360  __Pyx_BufFmt_StackElem __pyx_stack[1];
20361  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 911, __pyx_L1_error)
20362  }
20363  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2];
20364 
20365  /* "subsurfaceTransportFunctions.pyx":916
20366  * cdef int eN,k
20367  * cdef double pi,one8
20368  * pi = M_PI # <<<<<<<<<<<<<<
20369  * one8 = 1.0/8.0
20370  * for eN in range(x.shape[0]):
20371  */
20372  __pyx_v_pi = M_PI;
20373 
20374  /* "subsurfaceTransportFunctions.pyx":917
20375  * cdef double pi,one8
20376  * pi = M_PI
20377  * one8 = 1.0/8.0 # <<<<<<<<<<<<<<
20378  * for eN in range(x.shape[0]):
20379  * for k in range(x.shape[1]):
20380  */
20381  __pyx_v_one8 = (1.0 / 8.0);
20382 
20383  /* "subsurfaceTransportFunctions.pyx":918
20384  * pi = M_PI
20385  * one8 = 1.0/8.0
20386  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
20387  * for k in range(x.shape[1]):
20388  * v[eN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,k,1])*sin(pi*x[eN,k,0])*sin(pi*x[eN,k,0]);
20389  */
20390  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
20391  __pyx_t_2 = __pyx_t_1;
20392  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
20393  __pyx_v_eN = __pyx_t_3;
20394 
20395  /* "subsurfaceTransportFunctions.pyx":919
20396  * one8 = 1.0/8.0
20397  * for eN in range(x.shape[0]):
20398  * for k in range(x.shape[1]): # <<<<<<<<<<<<<<
20399  * v[eN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,k,1])*sin(pi*x[eN,k,0])*sin(pi*x[eN,k,0]);
20400  * v[eN,k,1]=-cos(pi*one8*t)*sin(2.0*pi*x[eN,k,0])*sin(pi*x[eN,k,1])*sin(pi*x[eN,k,1]);
20401  */
20402  __pyx_t_4 = (__pyx_v_x->dimensions[1]);
20403  __pyx_t_5 = __pyx_t_4;
20404  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
20405  __pyx_v_k = __pyx_t_6;
20406 
20407  /* "subsurfaceTransportFunctions.pyx":920
20408  * for eN in range(x.shape[0]):
20409  * for k in range(x.shape[1]):
20410  * v[eN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,k,1])*sin(pi*x[eN,k,0])*sin(pi*x[eN,k,0]); # <<<<<<<<<<<<<<
20411  * v[eN,k,1]=-cos(pi*one8*t)*sin(2.0*pi*x[eN,k,0])*sin(pi*x[eN,k,1])*sin(pi*x[eN,k,1]);
20412  *
20413  */
20414  __pyx_t_7 = __pyx_v_eN;
20415  __pyx_t_8 = __pyx_v_k;
20416  __pyx_t_9 = 1;
20417  __pyx_t_10 = -1;
20418  if (__pyx_t_7 < 0) {
20419  __pyx_t_7 += __pyx_pybuffernd_x.diminfo[0].shape;
20420  if (unlikely(__pyx_t_7 < 0)) __pyx_t_10 = 0;
20421  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_10 = 0;
20422  if (__pyx_t_8 < 0) {
20423  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[1].shape;
20424  if (unlikely(__pyx_t_8 < 0)) __pyx_t_10 = 1;
20425  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_10 = 1;
20426  if (__pyx_t_9 < 0) {
20427  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[2].shape;
20428  if (unlikely(__pyx_t_9 < 0)) __pyx_t_10 = 2;
20429  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_10 = 2;
20430  if (unlikely(__pyx_t_10 != -1)) {
20431  __Pyx_RaiseBufferIndexError(__pyx_t_10);
20432  __PYX_ERR(0, 920, __pyx_L1_error)
20433  }
20434  __pyx_t_11 = __pyx_v_eN;
20435  __pyx_t_12 = __pyx_v_k;
20436  __pyx_t_13 = 0;
20437  __pyx_t_10 = -1;
20438  if (__pyx_t_11 < 0) {
20439  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[0].shape;
20440  if (unlikely(__pyx_t_11 < 0)) __pyx_t_10 = 0;
20441  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_10 = 0;
20442  if (__pyx_t_12 < 0) {
20443  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[1].shape;
20444  if (unlikely(__pyx_t_12 < 0)) __pyx_t_10 = 1;
20445  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_10 = 1;
20446  if (__pyx_t_13 < 0) {
20447  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[2].shape;
20448  if (unlikely(__pyx_t_13 < 0)) __pyx_t_10 = 2;
20449  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_10 = 2;
20450  if (unlikely(__pyx_t_10 != -1)) {
20451  __Pyx_RaiseBufferIndexError(__pyx_t_10);
20452  __PYX_ERR(0, 920, __pyx_L1_error)
20453  }
20454  __pyx_t_14 = __pyx_v_eN;
20455  __pyx_t_15 = __pyx_v_k;
20456  __pyx_t_16 = 0;
20457  __pyx_t_10 = -1;
20458  if (__pyx_t_14 < 0) {
20459  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[0].shape;
20460  if (unlikely(__pyx_t_14 < 0)) __pyx_t_10 = 0;
20461  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_10 = 0;
20462  if (__pyx_t_15 < 0) {
20463  __pyx_t_15 += __pyx_pybuffernd_x.diminfo[1].shape;
20464  if (unlikely(__pyx_t_15 < 0)) __pyx_t_10 = 1;
20465  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_10 = 1;
20466  if (__pyx_t_16 < 0) {
20467  __pyx_t_16 += __pyx_pybuffernd_x.diminfo[2].shape;
20468  if (unlikely(__pyx_t_16 < 0)) __pyx_t_10 = 2;
20469  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_10 = 2;
20470  if (unlikely(__pyx_t_10 != -1)) {
20471  __Pyx_RaiseBufferIndexError(__pyx_t_10);
20472  __PYX_ERR(0, 920, __pyx_L1_error)
20473  }
20474  __pyx_t_17 = __pyx_v_eN;
20475  __pyx_t_18 = __pyx_v_k;
20476  __pyx_t_19 = 0;
20477  __pyx_t_10 = -1;
20478  if (__pyx_t_17 < 0) {
20479  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[0].shape;
20480  if (unlikely(__pyx_t_17 < 0)) __pyx_t_10 = 0;
20481  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_10 = 0;
20482  if (__pyx_t_18 < 0) {
20483  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[1].shape;
20484  if (unlikely(__pyx_t_18 < 0)) __pyx_t_10 = 1;
20485  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_10 = 1;
20486  if (__pyx_t_19 < 0) {
20487  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[2].shape;
20488  if (unlikely(__pyx_t_19 < 0)) __pyx_t_10 = 2;
20489  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_10 = 2;
20490  if (unlikely(__pyx_t_10 != -1)) {
20491  __Pyx_RaiseBufferIndexError(__pyx_t_10);
20492  __PYX_ERR(0, 920, __pyx_L1_error)
20493  }
20494  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_19, __pyx_pybuffernd_v.diminfo[2].strides) = (((cos(((__pyx_v_pi * __pyx_v_one8) * __pyx_v_t)) * sin(((2.0 * __pyx_v_pi) * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_9, __pyx_pybuffernd_x.diminfo[2].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[2].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_16, __pyx_pybuffernd_x.diminfo[2].strides)))));
20495 
20496  /* "subsurfaceTransportFunctions.pyx":921
20497  * for k in range(x.shape[1]):
20498  * v[eN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,k,1])*sin(pi*x[eN,k,0])*sin(pi*x[eN,k,0]);
20499  * v[eN,k,1]=-cos(pi*one8*t)*sin(2.0*pi*x[eN,k,0])*sin(pi*x[eN,k,1])*sin(pi*x[eN,k,1]); # <<<<<<<<<<<<<<
20500  *
20501  *
20502  */
20503  __pyx_t_16 = __pyx_v_eN;
20504  __pyx_t_15 = __pyx_v_k;
20505  __pyx_t_14 = 0;
20506  __pyx_t_10 = -1;
20507  if (__pyx_t_16 < 0) {
20508  __pyx_t_16 += __pyx_pybuffernd_x.diminfo[0].shape;
20509  if (unlikely(__pyx_t_16 < 0)) __pyx_t_10 = 0;
20510  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_10 = 0;
20511  if (__pyx_t_15 < 0) {
20512  __pyx_t_15 += __pyx_pybuffernd_x.diminfo[1].shape;
20513  if (unlikely(__pyx_t_15 < 0)) __pyx_t_10 = 1;
20514  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_10 = 1;
20515  if (__pyx_t_14 < 0) {
20516  __pyx_t_14 += __pyx_pybuffernd_x.diminfo[2].shape;
20517  if (unlikely(__pyx_t_14 < 0)) __pyx_t_10 = 2;
20518  } else if (unlikely(__pyx_t_14 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_10 = 2;
20519  if (unlikely(__pyx_t_10 != -1)) {
20520  __Pyx_RaiseBufferIndexError(__pyx_t_10);
20521  __PYX_ERR(0, 921, __pyx_L1_error)
20522  }
20523  __pyx_t_13 = __pyx_v_eN;
20524  __pyx_t_12 = __pyx_v_k;
20525  __pyx_t_11 = 1;
20526  __pyx_t_10 = -1;
20527  if (__pyx_t_13 < 0) {
20528  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[0].shape;
20529  if (unlikely(__pyx_t_13 < 0)) __pyx_t_10 = 0;
20530  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_10 = 0;
20531  if (__pyx_t_12 < 0) {
20532  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[1].shape;
20533  if (unlikely(__pyx_t_12 < 0)) __pyx_t_10 = 1;
20534  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_10 = 1;
20535  if (__pyx_t_11 < 0) {
20536  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[2].shape;
20537  if (unlikely(__pyx_t_11 < 0)) __pyx_t_10 = 2;
20538  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_10 = 2;
20539  if (unlikely(__pyx_t_10 != -1)) {
20540  __Pyx_RaiseBufferIndexError(__pyx_t_10);
20541  __PYX_ERR(0, 921, __pyx_L1_error)
20542  }
20543  __pyx_t_9 = __pyx_v_eN;
20544  __pyx_t_8 = __pyx_v_k;
20545  __pyx_t_7 = 1;
20546  __pyx_t_10 = -1;
20547  if (__pyx_t_9 < 0) {
20548  __pyx_t_9 += __pyx_pybuffernd_x.diminfo[0].shape;
20549  if (unlikely(__pyx_t_9 < 0)) __pyx_t_10 = 0;
20550  } else if (unlikely(__pyx_t_9 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_10 = 0;
20551  if (__pyx_t_8 < 0) {
20552  __pyx_t_8 += __pyx_pybuffernd_x.diminfo[1].shape;
20553  if (unlikely(__pyx_t_8 < 0)) __pyx_t_10 = 1;
20554  } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_10 = 1;
20555  if (__pyx_t_7 < 0) {
20556  __pyx_t_7 += __pyx_pybuffernd_x.diminfo[2].shape;
20557  if (unlikely(__pyx_t_7 < 0)) __pyx_t_10 = 2;
20558  } else if (unlikely(__pyx_t_7 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_10 = 2;
20559  if (unlikely(__pyx_t_10 != -1)) {
20560  __Pyx_RaiseBufferIndexError(__pyx_t_10);
20561  __PYX_ERR(0, 921, __pyx_L1_error)
20562  }
20563  __pyx_t_19 = __pyx_v_eN;
20564  __pyx_t_18 = __pyx_v_k;
20565  __pyx_t_17 = 1;
20566  __pyx_t_10 = -1;
20567  if (__pyx_t_19 < 0) {
20568  __pyx_t_19 += __pyx_pybuffernd_v.diminfo[0].shape;
20569  if (unlikely(__pyx_t_19 < 0)) __pyx_t_10 = 0;
20570  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_10 = 0;
20571  if (__pyx_t_18 < 0) {
20572  __pyx_t_18 += __pyx_pybuffernd_v.diminfo[1].shape;
20573  if (unlikely(__pyx_t_18 < 0)) __pyx_t_10 = 1;
20574  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_10 = 1;
20575  if (__pyx_t_17 < 0) {
20576  __pyx_t_17 += __pyx_pybuffernd_v.diminfo[2].shape;
20577  if (unlikely(__pyx_t_17 < 0)) __pyx_t_10 = 2;
20578  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_10 = 2;
20579  if (unlikely(__pyx_t_10 != -1)) {
20580  __Pyx_RaiseBufferIndexError(__pyx_t_10);
20581  __PYX_ERR(0, 921, __pyx_L1_error)
20582  }
20583  *__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_17, __pyx_pybuffernd_v.diminfo[2].strides) = ((((-cos(((__pyx_v_pi * __pyx_v_one8) * __pyx_v_t))) * sin(((2.0 * __pyx_v_pi) * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_15, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_14, __pyx_pybuffernd_x.diminfo[2].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_11, __pyx_pybuffernd_x.diminfo[2].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided3d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_7, __pyx_pybuffernd_x.diminfo[2].strides)))));
20584  }
20585  }
20586 
20587  /* "subsurfaceTransportFunctions.pyx":911
20588  * v[eN,ebN,k,2]=zVelocity
20589  *
20590  * def vortexElementVelocityEval3(double t, # <<<<<<<<<<<<<<
20591  * numpy.ndarray[DTYPE_t,ndim=3] x,
20592  * numpy.ndarray[DTYPE_t,ndim=3] v):
20593  */
20594 
20595  /* function exit code */
20596  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
20597  goto __pyx_L0;
20598  __pyx_L1_error:;
20599  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
20600  __Pyx_PyThreadState_declare
20601  __Pyx_PyThreadState_assign
20602  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
20603  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
20604  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
20605  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
20606  __Pyx_AddTraceback("subsurfaceTransportFunctions.vortexElementVelocityEval3", __pyx_clineno, __pyx_lineno, __pyx_filename);
20607  __pyx_r = NULL;
20608  goto __pyx_L2;
20609  __pyx_L0:;
20610  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
20611  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
20612  __pyx_L2:;
20613  __Pyx_XGIVEREF(__pyx_r);
20614  __Pyx_RefNannyFinishContext();
20615  return __pyx_r;
20616 }
20617 
20618 /* "subsurfaceTransportFunctions.pyx":924
20619  *
20620  *
20621  * def vortexElementVelocityEval4(double t, # <<<<<<<<<<<<<<
20622  * numpy.ndarray[DTYPE_t,ndim=4] x,
20623  * numpy.ndarray[DTYPE_t,ndim=4] v):
20624  */
20625 
20626 /* Python wrapper */
20627 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_57vortexElementVelocityEval4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
20628 static PyMethodDef __pyx_mdef_28subsurfaceTransportFunctions_57vortexElementVelocityEval4 = {"vortexElementVelocityEval4", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_28subsurfaceTransportFunctions_57vortexElementVelocityEval4, METH_VARARGS|METH_KEYWORDS, 0};
20629 static PyObject *__pyx_pw_28subsurfaceTransportFunctions_57vortexElementVelocityEval4(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
20630  double __pyx_v_t;
20631  PyArrayObject *__pyx_v_x = 0;
20632  PyArrayObject *__pyx_v_v = 0;
20633  int __pyx_lineno = 0;
20634  const char *__pyx_filename = NULL;
20635  int __pyx_clineno = 0;
20636  PyObject *__pyx_r = 0;
20637  __Pyx_RefNannyDeclarations
20638  __Pyx_RefNannySetupContext("vortexElementVelocityEval4 (wrapper)", 0);
20639  {
20640  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t,&__pyx_n_s_x,&__pyx_n_s_v,0};
20641  PyObject* values[3] = {0,0,0};
20642  if (unlikely(__pyx_kwds)) {
20643  Py_ssize_t kw_args;
20644  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
20645  switch (pos_args) {
20646  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
20647  CYTHON_FALLTHROUGH;
20648  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
20649  CYTHON_FALLTHROUGH;
20650  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
20651  CYTHON_FALLTHROUGH;
20652  case 0: break;
20653  default: goto __pyx_L5_argtuple_error;
20654  }
20655  kw_args = PyDict_Size(__pyx_kwds);
20656  switch (pos_args) {
20657  case 0:
20658  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t)) != 0)) kw_args--;
20659  else goto __pyx_L5_argtuple_error;
20660  CYTHON_FALLTHROUGH;
20661  case 1:
20662  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
20663  else {
20664  __Pyx_RaiseArgtupleInvalid("vortexElementVelocityEval4", 1, 3, 3, 1); __PYX_ERR(0, 924, __pyx_L3_error)
20665  }
20666  CYTHON_FALLTHROUGH;
20667  case 2:
20668  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
20669  else {
20670  __Pyx_RaiseArgtupleInvalid("vortexElementVelocityEval4", 1, 3, 3, 2); __PYX_ERR(0, 924, __pyx_L3_error)
20671  }
20672  }
20673  if (unlikely(kw_args > 0)) {
20674  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "vortexElementVelocityEval4") < 0)) __PYX_ERR(0, 924, __pyx_L3_error)
20675  }
20676  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
20677  goto __pyx_L5_argtuple_error;
20678  } else {
20679  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
20680  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
20681  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
20682  }
20683  __pyx_v_t = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 924, __pyx_L3_error)
20684  __pyx_v_x = ((PyArrayObject *)values[1]);
20685  __pyx_v_v = ((PyArrayObject *)values[2]);
20686  }
20687  goto __pyx_L4_argument_unpacking_done;
20688  __pyx_L5_argtuple_error:;
20689  __Pyx_RaiseArgtupleInvalid("vortexElementVelocityEval4", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 924, __pyx_L3_error)
20690  __pyx_L3_error:;
20691  __Pyx_AddTraceback("subsurfaceTransportFunctions.vortexElementVelocityEval4", __pyx_clineno, __pyx_lineno, __pyx_filename);
20692  __Pyx_RefNannyFinishContext();
20693  return NULL;
20694  __pyx_L4_argument_unpacking_done:;
20695  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 925, __pyx_L1_error)
20696  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_v), __pyx_ptype_5numpy_ndarray, 1, "v", 0))) __PYX_ERR(0, 926, __pyx_L1_error)
20697  __pyx_r = __pyx_pf_28subsurfaceTransportFunctions_56vortexElementVelocityEval4(__pyx_self, __pyx_v_t, __pyx_v_x, __pyx_v_v);
20698 
20699  /* function exit code */
20700  goto __pyx_L0;
20701  __pyx_L1_error:;
20702  __pyx_r = NULL;
20703  __pyx_L0:;
20704  __Pyx_RefNannyFinishContext();
20705  return __pyx_r;
20706 }
20707 
20708 static PyObject *__pyx_pf_28subsurfaceTransportFunctions_56vortexElementVelocityEval4(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_t, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_v) {
20709  int __pyx_v_eN;
20710  int __pyx_v_k;
20711  int __pyx_v_ebN;
20712  double __pyx_v_pi;
20713  double __pyx_v_one8;
20714  __Pyx_LocalBuf_ND __pyx_pybuffernd_v;
20715  __Pyx_Buffer __pyx_pybuffer_v;
20716  __Pyx_LocalBuf_ND __pyx_pybuffernd_x;
20717  __Pyx_Buffer __pyx_pybuffer_x;
20718  PyObject *__pyx_r = NULL;
20719  __Pyx_RefNannyDeclarations
20720  npy_intp __pyx_t_1;
20721  npy_intp __pyx_t_2;
20722  int __pyx_t_3;
20723  npy_intp __pyx_t_4;
20724  npy_intp __pyx_t_5;
20725  int __pyx_t_6;
20726  npy_intp __pyx_t_7;
20727  npy_intp __pyx_t_8;
20728  int __pyx_t_9;
20729  Py_ssize_t __pyx_t_10;
20730  Py_ssize_t __pyx_t_11;
20731  Py_ssize_t __pyx_t_12;
20732  Py_ssize_t __pyx_t_13;
20733  int __pyx_t_14;
20734  Py_ssize_t __pyx_t_15;
20735  Py_ssize_t __pyx_t_16;
20736  Py_ssize_t __pyx_t_17;
20737  Py_ssize_t __pyx_t_18;
20738  Py_ssize_t __pyx_t_19;
20739  Py_ssize_t __pyx_t_20;
20740  Py_ssize_t __pyx_t_21;
20741  Py_ssize_t __pyx_t_22;
20742  Py_ssize_t __pyx_t_23;
20743  Py_ssize_t __pyx_t_24;
20744  Py_ssize_t __pyx_t_25;
20745  Py_ssize_t __pyx_t_26;
20746  int __pyx_lineno = 0;
20747  const char *__pyx_filename = NULL;
20748  int __pyx_clineno = 0;
20749  __Pyx_RefNannySetupContext("vortexElementVelocityEval4", 0);
20750  __pyx_pybuffer_x.pybuffer.buf = NULL;
20751  __pyx_pybuffer_x.refcount = 0;
20752  __pyx_pybuffernd_x.data = NULL;
20753  __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x;
20754  __pyx_pybuffer_v.pybuffer.buf = NULL;
20755  __pyx_pybuffer_v.refcount = 0;
20756  __pyx_pybuffernd_v.data = NULL;
20757  __pyx_pybuffernd_v.rcbuffer = &__pyx_pybuffer_v;
20758  {
20759  __Pyx_BufFmt_StackElem __pyx_stack[1];
20760  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 924, __pyx_L1_error)
20761  }
20762  __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_x.diminfo[2].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_x.diminfo[2].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_x.diminfo[3].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_x.diminfo[3].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[3];
20763  {
20764  __Pyx_BufFmt_StackElem __pyx_stack[1];
20765  if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_v.rcbuffer->pybuffer, (PyObject*)__pyx_v_v, &__Pyx_TypeInfo_nn___pyx_t_28subsurfaceTransportFunctions_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 4, 0, __pyx_stack) == -1)) __PYX_ERR(0, 924, __pyx_L1_error)
20766  }
20767  __pyx_pybuffernd_v.diminfo[0].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_v.diminfo[0].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_v.diminfo[1].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_v.diminfo[1].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_v.diminfo[2].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_v.diminfo[2].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_v.diminfo[3].strides = __pyx_pybuffernd_v.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_v.diminfo[3].shape = __pyx_pybuffernd_v.rcbuffer->pybuffer.shape[3];
20768 
20769  /* "subsurfaceTransportFunctions.pyx":929
20770  * cdef int eN,k,ebN
20771  * cdef double pi,one8
20772  * pi = M_PI # <<<<<<<<<<<<<<
20773  * one8 = 1.0/8.0
20774  * for eN in range(x.shape[0]):
20775  */
20776  __pyx_v_pi = M_PI;
20777 
20778  /* "subsurfaceTransportFunctions.pyx":930
20779  * cdef double pi,one8
20780  * pi = M_PI
20781  * one8 = 1.0/8.0 # <<<<<<<<<<<<<<
20782  * for eN in range(x.shape[0]):
20783  * for ebN in range(x.shape[1]):
20784  */
20785  __pyx_v_one8 = (1.0 / 8.0);
20786 
20787  /* "subsurfaceTransportFunctions.pyx":931
20788  * pi = M_PI
20789  * one8 = 1.0/8.0
20790  * for eN in range(x.shape[0]): # <<<<<<<<<<<<<<
20791  * for ebN in range(x.shape[1]):
20792  * for k in range(x.shape[2]):
20793  */
20794  __pyx_t_1 = (__pyx_v_x->dimensions[0]);
20795  __pyx_t_2 = __pyx_t_1;
20796  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
20797  __pyx_v_eN = __pyx_t_3;
20798 
20799  /* "subsurfaceTransportFunctions.pyx":932
20800  * one8 = 1.0/8.0
20801  * for eN in range(x.shape[0]):
20802  * for ebN in range(x.shape[1]): # <<<<<<<<<<<<<<
20803  * for k in range(x.shape[2]):
20804  * v[eN,ebN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,ebN,k,1])*sin(pi*x[eN,ebN,k,0])*sin(pi*x[eN,ebN,k,0]);
20805  */
20806  __pyx_t_4 = (__pyx_v_x->dimensions[1]);
20807  __pyx_t_5 = __pyx_t_4;
20808  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
20809  __pyx_v_ebN = __pyx_t_6;
20810 
20811  /* "subsurfaceTransportFunctions.pyx":933
20812  * for eN in range(x.shape[0]):
20813  * for ebN in range(x.shape[1]):
20814  * for k in range(x.shape[2]): # <<<<<<<<<<<<<<
20815  * v[eN,ebN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,ebN,k,1])*sin(pi*x[eN,ebN,k,0])*sin(pi*x[eN,ebN,k,0]);
20816  * v[eN,ebN,k,1]=-cos(pi*one8*t)*sin(2.0*pi*x[eN,ebN,k,0])*sin(pi*x[eN,ebN,k,1])*sin(pi*x[eN,ebN,k,1]);
20817  */
20818  __pyx_t_7 = (__pyx_v_x->dimensions[2]);
20819  __pyx_t_8 = __pyx_t_7;
20820  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
20821  __pyx_v_k = __pyx_t_9;
20822 
20823  /* "subsurfaceTransportFunctions.pyx":934
20824  * for ebN in range(x.shape[1]):
20825  * for k in range(x.shape[2]):
20826  * v[eN,ebN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,ebN,k,1])*sin(pi*x[eN,ebN,k,0])*sin(pi*x[eN,ebN,k,0]); # <<<<<<<<<<<<<<
20827  * v[eN,ebN,k,1]=-cos(pi*one8*t)*sin(2.0*pi*x[eN,ebN,k,0])*sin(pi*x[eN,ebN,k,1])*sin(pi*x[eN,ebN,k,1]);
20828  *
20829  */
20830  __pyx_t_10 = __pyx_v_eN;
20831  __pyx_t_11 = __pyx_v_ebN;
20832  __pyx_t_12 = __pyx_v_k;
20833  __pyx_t_13 = 1;
20834  __pyx_t_14 = -1;
20835  if (__pyx_t_10 < 0) {
20836  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[0].shape;
20837  if (unlikely(__pyx_t_10 < 0)) __pyx_t_14 = 0;
20838  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_14 = 0;
20839  if (__pyx_t_11 < 0) {
20840  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[1].shape;
20841  if (unlikely(__pyx_t_11 < 0)) __pyx_t_14 = 1;
20842  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_14 = 1;
20843  if (__pyx_t_12 < 0) {
20844  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[2].shape;
20845  if (unlikely(__pyx_t_12 < 0)) __pyx_t_14 = 2;
20846  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_14 = 2;
20847  if (__pyx_t_13 < 0) {
20848  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[3].shape;
20849  if (unlikely(__pyx_t_13 < 0)) __pyx_t_14 = 3;
20850  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_14 = 3;
20851  if (unlikely(__pyx_t_14 != -1)) {
20852  __Pyx_RaiseBufferIndexError(__pyx_t_14);
20853  __PYX_ERR(0, 934, __pyx_L1_error)
20854  }
20855  __pyx_t_15 = __pyx_v_eN;
20856  __pyx_t_16 = __pyx_v_ebN;
20857  __pyx_t_17 = __pyx_v_k;
20858  __pyx_t_18 = 0;
20859  __pyx_t_14 = -1;
20860  if (__pyx_t_15 < 0) {
20861  __pyx_t_15 += __pyx_pybuffernd_x.diminfo[0].shape;
20862  if (unlikely(__pyx_t_15 < 0)) __pyx_t_14 = 0;
20863  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_14 = 0;
20864  if (__pyx_t_16 < 0) {
20865  __pyx_t_16 += __pyx_pybuffernd_x.diminfo[1].shape;
20866  if (unlikely(__pyx_t_16 < 0)) __pyx_t_14 = 1;
20867  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_14 = 1;
20868  if (__pyx_t_17 < 0) {
20869  __pyx_t_17 += __pyx_pybuffernd_x.diminfo[2].shape;
20870  if (unlikely(__pyx_t_17 < 0)) __pyx_t_14 = 2;
20871  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_14 = 2;
20872  if (__pyx_t_18 < 0) {
20873  __pyx_t_18 += __pyx_pybuffernd_x.diminfo[3].shape;
20874  if (unlikely(__pyx_t_18 < 0)) __pyx_t_14 = 3;
20875  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_14 = 3;
20876  if (unlikely(__pyx_t_14 != -1)) {
20877  __Pyx_RaiseBufferIndexError(__pyx_t_14);
20878  __PYX_ERR(0, 934, __pyx_L1_error)
20879  }
20880  __pyx_t_19 = __pyx_v_eN;
20881  __pyx_t_20 = __pyx_v_ebN;
20882  __pyx_t_21 = __pyx_v_k;
20883  __pyx_t_22 = 0;
20884  __pyx_t_14 = -1;
20885  if (__pyx_t_19 < 0) {
20886  __pyx_t_19 += __pyx_pybuffernd_x.diminfo[0].shape;
20887  if (unlikely(__pyx_t_19 < 0)) __pyx_t_14 = 0;
20888  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_14 = 0;
20889  if (__pyx_t_20 < 0) {
20890  __pyx_t_20 += __pyx_pybuffernd_x.diminfo[1].shape;
20891  if (unlikely(__pyx_t_20 < 0)) __pyx_t_14 = 1;
20892  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_14 = 1;
20893  if (__pyx_t_21 < 0) {
20894  __pyx_t_21 += __pyx_pybuffernd_x.diminfo[2].shape;
20895  if (unlikely(__pyx_t_21 < 0)) __pyx_t_14 = 2;
20896  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_14 = 2;
20897  if (__pyx_t_22 < 0) {
20898  __pyx_t_22 += __pyx_pybuffernd_x.diminfo[3].shape;
20899  if (unlikely(__pyx_t_22 < 0)) __pyx_t_14 = 3;
20900  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_14 = 3;
20901  if (unlikely(__pyx_t_14 != -1)) {
20902  __Pyx_RaiseBufferIndexError(__pyx_t_14);
20903  __PYX_ERR(0, 934, __pyx_L1_error)
20904  }
20905  __pyx_t_23 = __pyx_v_eN;
20906  __pyx_t_24 = __pyx_v_ebN;
20907  __pyx_t_25 = __pyx_v_k;
20908  __pyx_t_26 = 0;
20909  __pyx_t_14 = -1;
20910  if (__pyx_t_23 < 0) {
20911  __pyx_t_23 += __pyx_pybuffernd_v.diminfo[0].shape;
20912  if (unlikely(__pyx_t_23 < 0)) __pyx_t_14 = 0;
20913  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_14 = 0;
20914  if (__pyx_t_24 < 0) {
20915  __pyx_t_24 += __pyx_pybuffernd_v.diminfo[1].shape;
20916  if (unlikely(__pyx_t_24 < 0)) __pyx_t_14 = 1;
20917  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_14 = 1;
20918  if (__pyx_t_25 < 0) {
20919  __pyx_t_25 += __pyx_pybuffernd_v.diminfo[2].shape;
20920  if (unlikely(__pyx_t_25 < 0)) __pyx_t_14 = 2;
20921  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_14 = 2;
20922  if (__pyx_t_26 < 0) {
20923  __pyx_t_26 += __pyx_pybuffernd_v.diminfo[3].shape;
20924  if (unlikely(__pyx_t_26 < 0)) __pyx_t_14 = 3;
20925  } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_14 = 3;
20926  if (unlikely(__pyx_t_14 != -1)) {
20927  __Pyx_RaiseBufferIndexError(__pyx_t_14);
20928  __PYX_ERR(0, 934, __pyx_L1_error)
20929  }
20930  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_25, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_26, __pyx_pybuffernd_v.diminfo[3].strides) = (((cos(((__pyx_v_pi * __pyx_v_one8) * __pyx_v_t)) * sin(((2.0 * __pyx_v_pi) * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_13, __pyx_pybuffernd_x.diminfo[3].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_17, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_18, __pyx_pybuffernd_x.diminfo[3].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_21, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_22, __pyx_pybuffernd_x.diminfo[3].strides)))));
20931 
20932  /* "subsurfaceTransportFunctions.pyx":935
20933  * for k in range(x.shape[2]):
20934  * v[eN,ebN,k,0]= cos(pi*one8*t)*sin(2.0*pi*x[eN,ebN,k,1])*sin(pi*x[eN,ebN,k,0])*sin(pi*x[eN,ebN,k,0]);
20935  * v[eN,ebN,k,1]=-cos(pi*one8*t)*sin(2.0*pi*x[eN,ebN,k,0])*sin(pi*x[eN,ebN,k,1])*sin(pi*x[eN,ebN,k,1]); # <<<<<<<<<<<<<<
20936  *
20937  *
20938  */
20939  __pyx_t_22 = __pyx_v_eN;
20940  __pyx_t_21 = __pyx_v_ebN;
20941  __pyx_t_20 = __pyx_v_k;
20942  __pyx_t_19 = 0;
20943  __pyx_t_14 = -1;
20944  if (__pyx_t_22 < 0) {
20945  __pyx_t_22 += __pyx_pybuffernd_x.diminfo[0].shape;
20946  if (unlikely(__pyx_t_22 < 0)) __pyx_t_14 = 0;
20947  } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_14 = 0;
20948  if (__pyx_t_21 < 0) {
20949  __pyx_t_21 += __pyx_pybuffernd_x.diminfo[1].shape;
20950  if (unlikely(__pyx_t_21 < 0)) __pyx_t_14 = 1;
20951  } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_14 = 1;
20952  if (__pyx_t_20 < 0) {
20953  __pyx_t_20 += __pyx_pybuffernd_x.diminfo[2].shape;
20954  if (unlikely(__pyx_t_20 < 0)) __pyx_t_14 = 2;
20955  } else if (unlikely(__pyx_t_20 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_14 = 2;
20956  if (__pyx_t_19 < 0) {
20957  __pyx_t_19 += __pyx_pybuffernd_x.diminfo[3].shape;
20958  if (unlikely(__pyx_t_19 < 0)) __pyx_t_14 = 3;
20959  } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_14 = 3;
20960  if (unlikely(__pyx_t_14 != -1)) {
20961  __Pyx_RaiseBufferIndexError(__pyx_t_14);
20962  __PYX_ERR(0, 935, __pyx_L1_error)
20963  }
20964  __pyx_t_18 = __pyx_v_eN;
20965  __pyx_t_17 = __pyx_v_ebN;
20966  __pyx_t_16 = __pyx_v_k;
20967  __pyx_t_15 = 1;
20968  __pyx_t_14 = -1;
20969  if (__pyx_t_18 < 0) {
20970  __pyx_t_18 += __pyx_pybuffernd_x.diminfo[0].shape;
20971  if (unlikely(__pyx_t_18 < 0)) __pyx_t_14 = 0;
20972  } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_14 = 0;
20973  if (__pyx_t_17 < 0) {
20974  __pyx_t_17 += __pyx_pybuffernd_x.diminfo[1].shape;
20975  if (unlikely(__pyx_t_17 < 0)) __pyx_t_14 = 1;
20976  } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_14 = 1;
20977  if (__pyx_t_16 < 0) {
20978  __pyx_t_16 += __pyx_pybuffernd_x.diminfo[2].shape;
20979  if (unlikely(__pyx_t_16 < 0)) __pyx_t_14 = 2;
20980  } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_14 = 2;
20981  if (__pyx_t_15 < 0) {
20982  __pyx_t_15 += __pyx_pybuffernd_x.diminfo[3].shape;
20983  if (unlikely(__pyx_t_15 < 0)) __pyx_t_14 = 3;
20984  } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_14 = 3;
20985  if (unlikely(__pyx_t_14 != -1)) {
20986  __Pyx_RaiseBufferIndexError(__pyx_t_14);
20987  __PYX_ERR(0, 935, __pyx_L1_error)
20988  }
20989  __pyx_t_13 = __pyx_v_eN;
20990  __pyx_t_12 = __pyx_v_ebN;
20991  __pyx_t_11 = __pyx_v_k;
20992  __pyx_t_10 = 1;
20993  __pyx_t_14 = -1;
20994  if (__pyx_t_13 < 0) {
20995  __pyx_t_13 += __pyx_pybuffernd_x.diminfo[0].shape;
20996  if (unlikely(__pyx_t_13 < 0)) __pyx_t_14 = 0;
20997  } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_x.diminfo[0].shape)) __pyx_t_14 = 0;
20998  if (__pyx_t_12 < 0) {
20999  __pyx_t_12 += __pyx_pybuffernd_x.diminfo[1].shape;
21000  if (unlikely(__pyx_t_12 < 0)) __pyx_t_14 = 1;
21001  } else if (unlikely(__pyx_t_12 >= __pyx_pybuffernd_x.diminfo[1].shape)) __pyx_t_14 = 1;
21002  if (__pyx_t_11 < 0) {
21003  __pyx_t_11 += __pyx_pybuffernd_x.diminfo[2].shape;
21004  if (unlikely(__pyx_t_11 < 0)) __pyx_t_14 = 2;
21005  } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_x.diminfo[2].shape)) __pyx_t_14 = 2;
21006  if (__pyx_t_10 < 0) {
21007  __pyx_t_10 += __pyx_pybuffernd_x.diminfo[3].shape;
21008  if (unlikely(__pyx_t_10 < 0)) __pyx_t_14 = 3;
21009  } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_x.diminfo[3].shape)) __pyx_t_14 = 3;
21010  if (unlikely(__pyx_t_14 != -1)) {
21011  __Pyx_RaiseBufferIndexError(__pyx_t_14);
21012  __PYX_ERR(0, 935, __pyx_L1_error)
21013  }
21014  __pyx_t_26 = __pyx_v_eN;
21015  __pyx_t_25 = __pyx_v_ebN;
21016  __pyx_t_24 = __pyx_v_k;
21017  __pyx_t_23 = 1;
21018  __pyx_t_14 = -1;
21019  if (__pyx_t_26 < 0) {
21020  __pyx_t_26 += __pyx_pybuffernd_v.diminfo[0].shape;
21021  if (unlikely(__pyx_t_26 < 0)) __pyx_t_14 = 0;
21022  } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_v.diminfo[0].shape)) __pyx_t_14 = 0;
21023  if (__pyx_t_25 < 0) {
21024  __pyx_t_25 += __pyx_pybuffernd_v.diminfo[1].shape;
21025  if (unlikely(__pyx_t_25 < 0)) __pyx_t_14 = 1;
21026  } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_v.diminfo[1].shape)) __pyx_t_14 = 1;
21027  if (__pyx_t_24 < 0) {
21028  __pyx_t_24 += __pyx_pybuffernd_v.diminfo[2].shape;
21029  if (unlikely(__pyx_t_24 < 0)) __pyx_t_14 = 2;
21030  } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_v.diminfo[2].shape)) __pyx_t_14 = 2;
21031  if (__pyx_t_23 < 0) {
21032  __pyx_t_23 += __pyx_pybuffernd_v.diminfo[3].shape;
21033  if (unlikely(__pyx_t_23 < 0)) __pyx_t_14 = 3;
21034  } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_v.diminfo[3].shape)) __pyx_t_14 = 3;
21035  if (unlikely(__pyx_t_14 != -1)) {
21036  __Pyx_RaiseBufferIndexError(__pyx_t_14);
21037  __PYX_ERR(0, 935, __pyx_L1_error)
21038  }
21039  *__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_v.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_v.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_v.diminfo[1].strides, __pyx_t_24, __pyx_pybuffernd_v.diminfo[2].strides, __pyx_t_23, __pyx_pybuffernd_v.diminfo[3].strides) = ((((-cos(((__pyx_v_pi * __pyx_v_one8) * __pyx_v_t))) * sin(((2.0 * __pyx_v_pi) * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_20, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_19, __pyx_pybuffernd_x.diminfo[3].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_16, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_15, __pyx_pybuffernd_x.diminfo[3].strides))))) * sin((__pyx_v_pi * (*__Pyx_BufPtrStrided4d(__pyx_t_28subsurfaceTransportFunctions_DTYPE_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_x.diminfo[1].strides, __pyx_t_11, __pyx_pybuffernd_x.diminfo[2].strides, __pyx_t_10, __pyx_pybuffernd_x.diminfo[3].strides)))));
21040  }
21041  }
21042  }
21043 
21044  /* "subsurfaceTransportFunctions.pyx":924
21045  *
21046  *
21047  * def vortexElementVelocityEval4(double t, # <<<<<<<<<<<<<<
21048  * numpy.ndarray[DTYPE_t,ndim=4] x,
21049  * numpy.ndarray[DTYPE_t,ndim=4] v):
21050  */
21051 
21052  /* function exit code */
21053  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
21054  goto __pyx_L0;
21055  __pyx_L1_error:;
21056  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
21057  __Pyx_PyThreadState_declare
21058  __Pyx_PyThreadState_assign
21059  __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
21060  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
21061  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
21062  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
21063  __Pyx_AddTraceback("subsurfaceTransportFunctions.vortexElementVelocityEval4", __pyx_clineno, __pyx_lineno, __pyx_filename);
21064  __pyx_r = NULL;
21065  goto __pyx_L2;
21066  __pyx_L0:;
21067  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_v.rcbuffer->pybuffer);
21068  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_x.rcbuffer->pybuffer);
21069  __pyx_L2:;
21070  __Pyx_XGIVEREF(__pyx_r);
21071  __Pyx_RefNannyFinishContext();
21072  return __pyx_r;
21073 }
21074 
21075 /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":742
21076  * ctypedef npy_cdouble complex_t
21077  *
21078  * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
21079  * return PyArray_MultiIterNew(1, <void*>a)
21080  *
21081  */
21082 
21083 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
21084  PyObject *__pyx_r = NULL;
21085  __Pyx_RefNannyDeclarations
21086  PyObject *__pyx_t_1 = NULL;
21087  int __pyx_lineno = 0;
21088  const char *__pyx_filename = NULL;
21089  int __pyx_clineno = 0;
21090  __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);
21091 
21092  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":743
21093  *
21094  * cdef inline object PyArray_MultiIterNew1(a):
21095  * return PyArray_MultiIterNew(1, <void*>a) # <<<<<<<<<<<<<<
21096  *
21097  * cdef inline object PyArray_MultiIterNew2(a, b):
21098  */
21099  __Pyx_XDECREF(__pyx_r);
21100  __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 743, __pyx_L1_error)
21101  __Pyx_GOTREF(__pyx_t_1);
21102  __pyx_r = __pyx_t_1;
21103  __pyx_t_1 = 0;
21104  goto __pyx_L0;
21105 
21106  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":742
21107  * ctypedef npy_cdouble complex_t
21108  *
21109  * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
21110  * return PyArray_MultiIterNew(1, <void*>a)
21111  *
21112  */
21113 
21114  /* function exit code */
21115  __pyx_L1_error:;
21116  __Pyx_XDECREF(__pyx_t_1);
21117  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
21118  __pyx_r = 0;
21119  __pyx_L0:;
21120  __Pyx_XGIVEREF(__pyx_r);
21121  __Pyx_RefNannyFinishContext();
21122  return __pyx_r;
21123 }
21124 
21125 /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":745
21126  * return PyArray_MultiIterNew(1, <void*>a)
21127  *
21128  * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
21129  * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
21130  *
21131  */
21132 
21133 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
21134  PyObject *__pyx_r = NULL;
21135  __Pyx_RefNannyDeclarations
21136  PyObject *__pyx_t_1 = NULL;
21137  int __pyx_lineno = 0;
21138  const char *__pyx_filename = NULL;
21139  int __pyx_clineno = 0;
21140  __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);
21141 
21142  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":746
21143  *
21144  * cdef inline object PyArray_MultiIterNew2(a, b):
21145  * return PyArray_MultiIterNew(2, <void*>a, <void*>b) # <<<<<<<<<<<<<<
21146  *
21147  * cdef inline object PyArray_MultiIterNew3(a, b, c):
21148  */
21149  __Pyx_XDECREF(__pyx_r);
21150  __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 746, __pyx_L1_error)
21151  __Pyx_GOTREF(__pyx_t_1);
21152  __pyx_r = __pyx_t_1;
21153  __pyx_t_1 = 0;
21154  goto __pyx_L0;
21155 
21156  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":745
21157  * return PyArray_MultiIterNew(1, <void*>a)
21158  *
21159  * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
21160  * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
21161  *
21162  */
21163 
21164  /* function exit code */
21165  __pyx_L1_error:;
21166  __Pyx_XDECREF(__pyx_t_1);
21167  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
21168  __pyx_r = 0;
21169  __pyx_L0:;
21170  __Pyx_XGIVEREF(__pyx_r);
21171  __Pyx_RefNannyFinishContext();
21172  return __pyx_r;
21173 }
21174 
21175 /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":748
21176  * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
21177  *
21178  * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
21179  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
21180  *
21181  */
21182 
21183 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
21184  PyObject *__pyx_r = NULL;
21185  __Pyx_RefNannyDeclarations
21186  PyObject *__pyx_t_1 = NULL;
21187  int __pyx_lineno = 0;
21188  const char *__pyx_filename = NULL;
21189  int __pyx_clineno = 0;
21190  __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);
21191 
21192  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":749
21193  *
21194  * cdef inline object PyArray_MultiIterNew3(a, b, c):
21195  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c) # <<<<<<<<<<<<<<
21196  *
21197  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
21198  */
21199  __Pyx_XDECREF(__pyx_r);
21200  __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 749, __pyx_L1_error)
21201  __Pyx_GOTREF(__pyx_t_1);
21202  __pyx_r = __pyx_t_1;
21203  __pyx_t_1 = 0;
21204  goto __pyx_L0;
21205 
21206  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":748
21207  * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
21208  *
21209  * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
21210  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
21211  *
21212  */
21213 
21214  /* function exit code */
21215  __pyx_L1_error:;
21216  __Pyx_XDECREF(__pyx_t_1);
21217  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
21218  __pyx_r = 0;
21219  __pyx_L0:;
21220  __Pyx_XGIVEREF(__pyx_r);
21221  __Pyx_RefNannyFinishContext();
21222  return __pyx_r;
21223 }
21224 
21225 /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":751
21226  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
21227  *
21228  * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
21229  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
21230  *
21231  */
21232 
21233 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) {
21234  PyObject *__pyx_r = NULL;
21235  __Pyx_RefNannyDeclarations
21236  PyObject *__pyx_t_1 = NULL;
21237  int __pyx_lineno = 0;
21238  const char *__pyx_filename = NULL;
21239  int __pyx_clineno = 0;
21240  __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);
21241 
21242  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":752
21243  *
21244  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
21245  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d) # <<<<<<<<<<<<<<
21246  *
21247  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
21248  */
21249  __Pyx_XDECREF(__pyx_r);
21250  __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 752, __pyx_L1_error)
21251  __Pyx_GOTREF(__pyx_t_1);
21252  __pyx_r = __pyx_t_1;
21253  __pyx_t_1 = 0;
21254  goto __pyx_L0;
21255 
21256  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":751
21257  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
21258  *
21259  * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
21260  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
21261  *
21262  */
21263 
21264  /* function exit code */
21265  __pyx_L1_error:;
21266  __Pyx_XDECREF(__pyx_t_1);
21267  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
21268  __pyx_r = 0;
21269  __pyx_L0:;
21270  __Pyx_XGIVEREF(__pyx_r);
21271  __Pyx_RefNannyFinishContext();
21272  return __pyx_r;
21273 }
21274 
21275 /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":754
21276  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
21277  *
21278  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
21279  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
21280  *
21281  */
21282 
21283 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) {
21284  PyObject *__pyx_r = NULL;
21285  __Pyx_RefNannyDeclarations
21286  PyObject *__pyx_t_1 = NULL;
21287  int __pyx_lineno = 0;
21288  const char *__pyx_filename = NULL;
21289  int __pyx_clineno = 0;
21290  __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);
21291 
21292  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":755
21293  *
21294  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
21295  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e) # <<<<<<<<<<<<<<
21296  *
21297  * cdef inline tuple PyDataType_SHAPE(dtype d):
21298  */
21299  __Pyx_XDECREF(__pyx_r);
21300  __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 755, __pyx_L1_error)
21301  __Pyx_GOTREF(__pyx_t_1);
21302  __pyx_r = __pyx_t_1;
21303  __pyx_t_1 = 0;
21304  goto __pyx_L0;
21305 
21306  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":754
21307  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
21308  *
21309  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
21310  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
21311  *
21312  */
21313 
21314  /* function exit code */
21315  __pyx_L1_error:;
21316  __Pyx_XDECREF(__pyx_t_1);
21317  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
21318  __pyx_r = 0;
21319  __pyx_L0:;
21320  __Pyx_XGIVEREF(__pyx_r);
21321  __Pyx_RefNannyFinishContext();
21322  return __pyx_r;
21323 }
21324 
21325 /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":757
21326  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
21327  *
21328  * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<<
21329  * if PyDataType_HASSUBARRAY(d):
21330  * return <tuple>d.subarray.shape
21331  */
21332 
21333 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
21334  PyObject *__pyx_r = NULL;
21335  __Pyx_RefNannyDeclarations
21336  int __pyx_t_1;
21337  __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0);
21338 
21339  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":758
21340  *
21341  * cdef inline tuple PyDataType_SHAPE(dtype d):
21342  * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<<
21343  * return <tuple>d.subarray.shape
21344  * else:
21345  */
21346  __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
21347  if (__pyx_t_1) {
21348 
21349  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":759
21350  * cdef inline tuple PyDataType_SHAPE(dtype d):
21351  * if PyDataType_HASSUBARRAY(d):
21352  * return <tuple>d.subarray.shape # <<<<<<<<<<<<<<
21353  * else:
21354  * return ()
21355  */
21356  __Pyx_XDECREF(__pyx_r);
21357  __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
21358  __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
21359  goto __pyx_L0;
21360 
21361  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":758
21362  *
21363  * cdef inline tuple PyDataType_SHAPE(dtype d):
21364  * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<<
21365  * return <tuple>d.subarray.shape
21366  * else:
21367  */
21368  }
21369 
21370  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":761
21371  * return <tuple>d.subarray.shape
21372  * else:
21373  * return () # <<<<<<<<<<<<<<
21374  *
21375  * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:
21376  */
21377  /*else*/ {
21378  __Pyx_XDECREF(__pyx_r);
21379  __Pyx_INCREF(__pyx_empty_tuple);
21380  __pyx_r = __pyx_empty_tuple;
21381  goto __pyx_L0;
21382  }
21383 
21384  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":757
21385  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
21386  *
21387  * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<<
21388  * if PyDataType_HASSUBARRAY(d):
21389  * return <tuple>d.subarray.shape
21390  */
21391 
21392  /* function exit code */
21393  __pyx_L0:;
21394  __Pyx_XGIVEREF(__pyx_r);
21395  __Pyx_RefNannyFinishContext();
21396  return __pyx_r;
21397 }
21398 
21399 /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":763
21400  * return ()
21401  *
21402  * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<<
21403  * # Recursive utility function used in __getbuffer__ to get format
21404  * # string. The new location in the format string is returned.
21405  */
21406 
21407 static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) {
21408  PyArray_Descr *__pyx_v_child = 0;
21409  int __pyx_v_endian_detector;
21410  int __pyx_v_little_endian;
21411  PyObject *__pyx_v_fields = 0;
21412  PyObject *__pyx_v_childname = NULL;
21413  PyObject *__pyx_v_new_offset = NULL;
21414  PyObject *__pyx_v_t = NULL;
21415  char *__pyx_r;
21416  __Pyx_RefNannyDeclarations
21417  PyObject *__pyx_t_1 = NULL;
21418  Py_ssize_t __pyx_t_2;
21419  PyObject *__pyx_t_3 = NULL;
21420  PyObject *__pyx_t_4 = NULL;
21421  int __pyx_t_5;
21422  int __pyx_t_6;
21423  int __pyx_t_7;
21424  long __pyx_t_8;
21425  char *__pyx_t_9;
21426  int __pyx_lineno = 0;
21427  const char *__pyx_filename = NULL;
21428  int __pyx_clineno = 0;
21429  __Pyx_RefNannySetupContext("_util_dtypestring", 0);
21430 
21431  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":768
21432  *
21433  * cdef dtype child
21434  * cdef int endian_detector = 1 # <<<<<<<<<<<<<<
21435  * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
21436  * cdef tuple fields
21437  */
21438  __pyx_v_endian_detector = 1;
21439 
21440  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":769
21441  * cdef dtype child
21442  * cdef int endian_detector = 1
21443  * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0) # <<<<<<<<<<<<<<
21444  * cdef tuple fields
21445  *
21446  */
21447  __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
21448 
21449  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":772
21450  * cdef tuple fields
21451  *
21452  * for childname in descr.names: # <<<<<<<<<<<<<<
21453  * fields = descr.fields[childname]
21454  * child, new_offset = fields
21455  */
21456  if (unlikely(__pyx_v_descr->names == Py_None)) {
21457  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
21458  __PYX_ERR(1, 772, __pyx_L1_error)
21459  }
21460  __pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
21461  for (;;) {
21462  if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
21463  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
21464  __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 772, __pyx_L1_error)
21465  #else
21466  __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 772, __pyx_L1_error)
21467  __Pyx_GOTREF(__pyx_t_3);
21468  #endif
21469  __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
21470  __pyx_t_3 = 0;
21471 
21472  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":773
21473  *
21474  * for childname in descr.names:
21475  * fields = descr.fields[childname] # <<<<<<<<<<<<<<
21476  * child, new_offset = fields
21477  *
21478  */
21479  if (unlikely(__pyx_v_descr->fields == Py_None)) {
21480  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
21481  __PYX_ERR(1, 773, __pyx_L1_error)
21482  }
21483  __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 773, __pyx_L1_error)
21484  __Pyx_GOTREF(__pyx_t_3);
21485  if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(1, 773, __pyx_L1_error)
21486  __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3));
21487  __pyx_t_3 = 0;
21488 
21489  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":774
21490  * for childname in descr.names:
21491  * fields = descr.fields[childname]
21492  * child, new_offset = fields # <<<<<<<<<<<<<<
21493  *
21494  * if (end - f) - <int>(new_offset - offset[0]) < 15:
21495  */
21496  if (likely(__pyx_v_fields != Py_None)) {
21497  PyObject* sequence = __pyx_v_fields;
21498  Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
21499  if (unlikely(size != 2)) {
21500  if (size > 2) __Pyx_RaiseTooManyValuesError(2);
21501  else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
21502  __PYX_ERR(1, 774, __pyx_L1_error)
21503  }
21504  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
21505  __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
21506  __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
21507  __Pyx_INCREF(__pyx_t_3);
21508  __Pyx_INCREF(__pyx_t_4);
21509  #else
21510  __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 774, __pyx_L1_error)
21511  __Pyx_GOTREF(__pyx_t_3);
21512  __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 774, __pyx_L1_error)
21513  __Pyx_GOTREF(__pyx_t_4);
21514  #endif
21515  } else {
21516  __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 774, __pyx_L1_error)
21517  }
21518  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) __PYX_ERR(1, 774, __pyx_L1_error)
21519  __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3));
21520  __pyx_t_3 = 0;
21521  __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4);
21522  __pyx_t_4 = 0;
21523 
21524  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":776
21525  * child, new_offset = fields
21526  *
21527  * if (end - f) - <int>(new_offset - offset[0]) < 15: # <<<<<<<<<<<<<<
21528  * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
21529  *
21530  */
21531  __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 776, __pyx_L1_error)
21532  __Pyx_GOTREF(__pyx_t_4);
21533  __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 776, __pyx_L1_error)
21534  __Pyx_GOTREF(__pyx_t_3);
21535  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21536  __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 776, __pyx_L1_error)
21537  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21538  __pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((int)__pyx_t_5)) < 15) != 0);
21539  if (unlikely(__pyx_t_6)) {
21540 
21541  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":777
21542  *
21543  * if (end - f) - <int>(new_offset - offset[0]) < 15:
21544  * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<<
21545  *
21546  * if ((child.byteorder == c'>' and little_endian) or
21547  */
21548  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 777, __pyx_L1_error)
21549  __Pyx_GOTREF(__pyx_t_3);
21550  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
21551  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21552  __PYX_ERR(1, 777, __pyx_L1_error)
21553 
21554  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":776
21555  * child, new_offset = fields
21556  *
21557  * if (end - f) - <int>(new_offset - offset[0]) < 15: # <<<<<<<<<<<<<<
21558  * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
21559  *
21560  */
21561  }
21562 
21563  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":779
21564  * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
21565  *
21566  * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
21567  * (child.byteorder == c'<' and not little_endian)):
21568  * raise ValueError(u"Non-native byte order not supported")
21569  */
21570  __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0);
21571  if (!__pyx_t_7) {
21572  goto __pyx_L8_next_or;
21573  } else {
21574  }
21575  __pyx_t_7 = (__pyx_v_little_endian != 0);
21576  if (!__pyx_t_7) {
21577  } else {
21578  __pyx_t_6 = __pyx_t_7;
21579  goto __pyx_L7_bool_binop_done;
21580  }
21581  __pyx_L8_next_or:;
21582 
21583  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":780
21584  *
21585  * if ((child.byteorder == c'>' and little_endian) or
21586  * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<<
21587  * raise ValueError(u"Non-native byte order not supported")
21588  * # One could encode it in the format string and have Cython
21589  */
21590  __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0);
21591  if (__pyx_t_7) {
21592  } else {
21593  __pyx_t_6 = __pyx_t_7;
21594  goto __pyx_L7_bool_binop_done;
21595  }
21596  __pyx_t_7 = ((!(__pyx_v_little_endian != 0)) != 0);
21597  __pyx_t_6 = __pyx_t_7;
21598  __pyx_L7_bool_binop_done:;
21599 
21600  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":779
21601  * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
21602  *
21603  * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
21604  * (child.byteorder == c'<' and not little_endian)):
21605  * raise ValueError(u"Non-native byte order not supported")
21606  */
21607  if (unlikely(__pyx_t_6)) {
21608 
21609  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":781
21610  * if ((child.byteorder == c'>' and little_endian) or
21611  * (child.byteorder == c'<' and not little_endian)):
21612  * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
21613  * # One could encode it in the format string and have Cython
21614  * # complain instead, BUT: < and > in format strings also imply
21615  */
21616  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 781, __pyx_L1_error)
21617  __Pyx_GOTREF(__pyx_t_3);
21618  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
21619  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21620  __PYX_ERR(1, 781, __pyx_L1_error)
21621 
21622  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":779
21623  * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
21624  *
21625  * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
21626  * (child.byteorder == c'<' and not little_endian)):
21627  * raise ValueError(u"Non-native byte order not supported")
21628  */
21629  }
21630 
21631  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":791
21632  *
21633  * # Output padding bytes
21634  * while offset[0] < new_offset: # <<<<<<<<<<<<<<
21635  * f[0] = 120 # "x"; pad byte
21636  * f += 1
21637  */
21638  while (1) {
21639  __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 791, __pyx_L1_error)
21640  __Pyx_GOTREF(__pyx_t_3);
21641  __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 791, __pyx_L1_error)
21642  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21643  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 791, __pyx_L1_error)
21644  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21645  if (!__pyx_t_6) break;
21646 
21647  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":792
21648  * # Output padding bytes
21649  * while offset[0] < new_offset:
21650  * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<<
21651  * f += 1
21652  * offset[0] += 1
21653  */
21654  (__pyx_v_f[0]) = 0x78;
21655 
21656  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":793
21657  * while offset[0] < new_offset:
21658  * f[0] = 120 # "x"; pad byte
21659  * f += 1 # <<<<<<<<<<<<<<
21660  * offset[0] += 1
21661  *
21662  */
21663  __pyx_v_f = (__pyx_v_f + 1);
21664 
21665  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":794
21666  * f[0] = 120 # "x"; pad byte
21667  * f += 1
21668  * offset[0] += 1 # <<<<<<<<<<<<<<
21669  *
21670  * offset[0] += child.itemsize
21671  */
21672  __pyx_t_8 = 0;
21673  (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + 1);
21674  }
21675 
21676  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":796
21677  * offset[0] += 1
21678  *
21679  * offset[0] += child.itemsize # <<<<<<<<<<<<<<
21680  *
21681  * if not PyDataType_HASFIELDS(child):
21682  */
21683  __pyx_t_8 = 0;
21684  (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize);
21685 
21686  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":798
21687  * offset[0] += child.itemsize
21688  *
21689  * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<<
21690  * t = child.type_num
21691  * if end - f < 5:
21692  */
21693  __pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
21694  if (__pyx_t_6) {
21695 
21696  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":799
21697  *
21698  * if not PyDataType_HASFIELDS(child):
21699  * t = child.type_num # <<<<<<<<<<<<<<
21700  * if end - f < 5:
21701  * raise RuntimeError(u"Format string allocated too short.")
21702  */
21703  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 799, __pyx_L1_error)
21704  __Pyx_GOTREF(__pyx_t_4);
21705  __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4);
21706  __pyx_t_4 = 0;
21707 
21708  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":800
21709  * if not PyDataType_HASFIELDS(child):
21710  * t = child.type_num
21711  * if end - f < 5: # <<<<<<<<<<<<<<
21712  * raise RuntimeError(u"Format string allocated too short.")
21713  *
21714  */
21715  __pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
21716  if (unlikely(__pyx_t_6)) {
21717 
21718  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":801
21719  * t = child.type_num
21720  * if end - f < 5:
21721  * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<<
21722  *
21723  * # Until ticket #99 is fixed, use integers to avoid warnings
21724  */
21725  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 801, __pyx_L1_error)
21726  __Pyx_GOTREF(__pyx_t_4);
21727  __Pyx_Raise(__pyx_t_4, 0, 0, 0);
21728  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21729  __PYX_ERR(1, 801, __pyx_L1_error)
21730 
21731  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":800
21732  * if not PyDataType_HASFIELDS(child):
21733  * t = child.type_num
21734  * if end - f < 5: # <<<<<<<<<<<<<<
21735  * raise RuntimeError(u"Format string allocated too short.")
21736  *
21737  */
21738  }
21739 
21740  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":804
21741  *
21742  * # Until ticket #99 is fixed, use integers to avoid warnings
21743  * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<<
21744  * elif t == NPY_UBYTE: f[0] = 66 #"B"
21745  * elif t == NPY_SHORT: f[0] = 104 #"h"
21746  */
21747  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_BYTE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 804, __pyx_L1_error)
21748  __Pyx_GOTREF(__pyx_t_4);
21749  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 804, __pyx_L1_error)
21750  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21751  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 804, __pyx_L1_error)
21752  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21753  if (__pyx_t_6) {
21754  (__pyx_v_f[0]) = 98;
21755  goto __pyx_L15;
21756  }
21757 
21758  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":805
21759  * # Until ticket #99 is fixed, use integers to avoid warnings
21760  * if t == NPY_BYTE: f[0] = 98 #"b"
21761  * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<<
21762  * elif t == NPY_SHORT: f[0] = 104 #"h"
21763  * elif t == NPY_USHORT: f[0] = 72 #"H"
21764  */
21765  __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UBYTE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 805, __pyx_L1_error)
21766  __Pyx_GOTREF(__pyx_t_3);
21767  __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 805, __pyx_L1_error)
21768  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21769  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 805, __pyx_L1_error)
21770  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21771  if (__pyx_t_6) {
21772  (__pyx_v_f[0]) = 66;
21773  goto __pyx_L15;
21774  }
21775 
21776  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":806
21777  * if t == NPY_BYTE: f[0] = 98 #"b"
21778  * elif t == NPY_UBYTE: f[0] = 66 #"B"
21779  * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<<
21780  * elif t == NPY_USHORT: f[0] = 72 #"H"
21781  * elif t == NPY_INT: f[0] = 105 #"i"
21782  */
21783  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_SHORT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 806, __pyx_L1_error)
21784  __Pyx_GOTREF(__pyx_t_4);
21785  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 806, __pyx_L1_error)
21786  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21787  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 806, __pyx_L1_error)
21788  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21789  if (__pyx_t_6) {
21790  (__pyx_v_f[0]) = 0x68;
21791  goto __pyx_L15;
21792  }
21793 
21794  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":807
21795  * elif t == NPY_UBYTE: f[0] = 66 #"B"
21796  * elif t == NPY_SHORT: f[0] = 104 #"h"
21797  * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<<
21798  * elif t == NPY_INT: f[0] = 105 #"i"
21799  * elif t == NPY_UINT: f[0] = 73 #"I"
21800  */
21801  __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_USHORT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 807, __pyx_L1_error)
21802  __Pyx_GOTREF(__pyx_t_3);
21803  __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 807, __pyx_L1_error)
21804  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21805  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 807, __pyx_L1_error)
21806  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21807  if (__pyx_t_6) {
21808  (__pyx_v_f[0]) = 72;
21809  goto __pyx_L15;
21810  }
21811 
21812  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":808
21813  * elif t == NPY_SHORT: f[0] = 104 #"h"
21814  * elif t == NPY_USHORT: f[0] = 72 #"H"
21815  * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<<
21816  * elif t == NPY_UINT: f[0] = 73 #"I"
21817  * elif t == NPY_LONG: f[0] = 108 #"l"
21818  */
21819  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_INT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 808, __pyx_L1_error)
21820  __Pyx_GOTREF(__pyx_t_4);
21821  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 808, __pyx_L1_error)
21822  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21823  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 808, __pyx_L1_error)
21824  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21825  if (__pyx_t_6) {
21826  (__pyx_v_f[0]) = 0x69;
21827  goto __pyx_L15;
21828  }
21829 
21830  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":809
21831  * elif t == NPY_USHORT: f[0] = 72 #"H"
21832  * elif t == NPY_INT: f[0] = 105 #"i"
21833  * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<<
21834  * elif t == NPY_LONG: f[0] = 108 #"l"
21835  * elif t == NPY_ULONG: f[0] = 76 #"L"
21836  */
21837  __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UINT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 809, __pyx_L1_error)
21838  __Pyx_GOTREF(__pyx_t_3);
21839  __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 809, __pyx_L1_error)
21840  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21841  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 809, __pyx_L1_error)
21842  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21843  if (__pyx_t_6) {
21844  (__pyx_v_f[0]) = 73;
21845  goto __pyx_L15;
21846  }
21847 
21848  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":810
21849  * elif t == NPY_INT: f[0] = 105 #"i"
21850  * elif t == NPY_UINT: f[0] = 73 #"I"
21851  * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<<
21852  * elif t == NPY_ULONG: f[0] = 76 #"L"
21853  * elif t == NPY_LONGLONG: f[0] = 113 #"q"
21854  */
21855  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 810, __pyx_L1_error)
21856  __Pyx_GOTREF(__pyx_t_4);
21857  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 810, __pyx_L1_error)
21858  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21859  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 810, __pyx_L1_error)
21860  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21861  if (__pyx_t_6) {
21862  (__pyx_v_f[0]) = 0x6C;
21863  goto __pyx_L15;
21864  }
21865 
21866  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":811
21867  * elif t == NPY_UINT: f[0] = 73 #"I"
21868  * elif t == NPY_LONG: f[0] = 108 #"l"
21869  * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<<
21870  * elif t == NPY_LONGLONG: f[0] = 113 #"q"
21871  * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
21872  */
21873  __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 811, __pyx_L1_error)
21874  __Pyx_GOTREF(__pyx_t_3);
21875  __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 811, __pyx_L1_error)
21876  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21877  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 811, __pyx_L1_error)
21878  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21879  if (__pyx_t_6) {
21880  (__pyx_v_f[0]) = 76;
21881  goto __pyx_L15;
21882  }
21883 
21884  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":812
21885  * elif t == NPY_LONG: f[0] = 108 #"l"
21886  * elif t == NPY_ULONG: f[0] = 76 #"L"
21887  * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<<
21888  * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
21889  * elif t == NPY_FLOAT: f[0] = 102 #"f"
21890  */
21891  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 812, __pyx_L1_error)
21892  __Pyx_GOTREF(__pyx_t_4);
21893  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 812, __pyx_L1_error)
21894  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21895  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 812, __pyx_L1_error)
21896  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21897  if (__pyx_t_6) {
21898  (__pyx_v_f[0]) = 0x71;
21899  goto __pyx_L15;
21900  }
21901 
21902  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":813
21903  * elif t == NPY_ULONG: f[0] = 76 #"L"
21904  * elif t == NPY_LONGLONG: f[0] = 113 #"q"
21905  * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<<
21906  * elif t == NPY_FLOAT: f[0] = 102 #"f"
21907  * elif t == NPY_DOUBLE: f[0] = 100 #"d"
21908  */
21909  __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 813, __pyx_L1_error)
21910  __Pyx_GOTREF(__pyx_t_3);
21911  __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 813, __pyx_L1_error)
21912  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21913  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 813, __pyx_L1_error)
21914  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21915  if (__pyx_t_6) {
21916  (__pyx_v_f[0]) = 81;
21917  goto __pyx_L15;
21918  }
21919 
21920  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":814
21921  * elif t == NPY_LONGLONG: f[0] = 113 #"q"
21922  * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
21923  * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<<
21924  * elif t == NPY_DOUBLE: f[0] = 100 #"d"
21925  * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
21926  */
21927  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_FLOAT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 814, __pyx_L1_error)
21928  __Pyx_GOTREF(__pyx_t_4);
21929  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 814, __pyx_L1_error)
21930  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21931  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 814, __pyx_L1_error)
21932  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21933  if (__pyx_t_6) {
21934  (__pyx_v_f[0]) = 0x66;
21935  goto __pyx_L15;
21936  }
21937 
21938  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":815
21939  * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
21940  * elif t == NPY_FLOAT: f[0] = 102 #"f"
21941  * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<<
21942  * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
21943  * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
21944  */
21945  __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 815, __pyx_L1_error)
21946  __Pyx_GOTREF(__pyx_t_3);
21947  __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 815, __pyx_L1_error)
21948  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21949  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 815, __pyx_L1_error)
21950  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21951  if (__pyx_t_6) {
21952  (__pyx_v_f[0]) = 0x64;
21953  goto __pyx_L15;
21954  }
21955 
21956  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":816
21957  * elif t == NPY_FLOAT: f[0] = 102 #"f"
21958  * elif t == NPY_DOUBLE: f[0] = 100 #"d"
21959  * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<<
21960  * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
21961  * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
21962  */
21963  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 816, __pyx_L1_error)
21964  __Pyx_GOTREF(__pyx_t_4);
21965  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 816, __pyx_L1_error)
21966  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21967  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 816, __pyx_L1_error)
21968  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21969  if (__pyx_t_6) {
21970  (__pyx_v_f[0]) = 0x67;
21971  goto __pyx_L15;
21972  }
21973 
21974  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":817
21975  * elif t == NPY_DOUBLE: f[0] = 100 #"d"
21976  * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
21977  * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<<
21978  * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
21979  * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
21980  */
21981  __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 817, __pyx_L1_error)
21982  __Pyx_GOTREF(__pyx_t_3);
21983  __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 817, __pyx_L1_error)
21984  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21985  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 817, __pyx_L1_error)
21986  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21987  if (__pyx_t_6) {
21988  (__pyx_v_f[0]) = 90;
21989  (__pyx_v_f[1]) = 0x66;
21990  __pyx_v_f = (__pyx_v_f + 1);
21991  goto __pyx_L15;
21992  }
21993 
21994  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":818
21995  * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
21996  * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
21997  * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<<
21998  * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
21999  * elif t == NPY_OBJECT: f[0] = 79 #"O"
22000  */
22001  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 818, __pyx_L1_error)
22002  __Pyx_GOTREF(__pyx_t_4);
22003  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 818, __pyx_L1_error)
22004  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22005  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 818, __pyx_L1_error)
22006  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22007  if (__pyx_t_6) {
22008  (__pyx_v_f[0]) = 90;
22009  (__pyx_v_f[1]) = 0x64;
22010  __pyx_v_f = (__pyx_v_f + 1);
22011  goto __pyx_L15;
22012  }
22013 
22014  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":819
22015  * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
22016  * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
22017  * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<<
22018  * elif t == NPY_OBJECT: f[0] = 79 #"O"
22019  * else:
22020  */
22021  __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 819, __pyx_L1_error)
22022  __Pyx_GOTREF(__pyx_t_3);
22023  __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 819, __pyx_L1_error)
22024  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22025  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 819, __pyx_L1_error)
22026  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22027  if (__pyx_t_6) {
22028  (__pyx_v_f[0]) = 90;
22029  (__pyx_v_f[1]) = 0x67;
22030  __pyx_v_f = (__pyx_v_f + 1);
22031  goto __pyx_L15;
22032  }
22033 
22034  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":820
22035  * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
22036  * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
22037  * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<<
22038  * else:
22039  * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
22040  */
22041  __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_OBJECT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 820, __pyx_L1_error)
22042  __Pyx_GOTREF(__pyx_t_4);
22043  __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 820, __pyx_L1_error)
22044  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22045  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 820, __pyx_L1_error)
22046  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22047  if (likely(__pyx_t_6)) {
22048  (__pyx_v_f[0]) = 79;
22049  goto __pyx_L15;
22050  }
22051 
22052  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":822
22053  * elif t == NPY_OBJECT: f[0] = 79 #"O"
22054  * else:
22055  * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<<
22056  * f += 1
22057  * else:
22058  */
22059  /*else*/ {
22060  __pyx_t_3 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 822, __pyx_L1_error)
22061  __Pyx_GOTREF(__pyx_t_3);
22062  __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 822, __pyx_L1_error)
22063  __Pyx_GOTREF(__pyx_t_4);
22064  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22065  __Pyx_Raise(__pyx_t_4, 0, 0, 0);
22066  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22067  __PYX_ERR(1, 822, __pyx_L1_error)
22068  }
22069  __pyx_L15:;
22070 
22071  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":823
22072  * else:
22073  * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
22074  * f += 1 # <<<<<<<<<<<<<<
22075  * else:
22076  * # Cython ignores struct boundary information ("T{...}"),
22077  */
22078  __pyx_v_f = (__pyx_v_f + 1);
22079 
22080  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":798
22081  * offset[0] += child.itemsize
22082  *
22083  * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<<
22084  * t = child.type_num
22085  * if end - f < 5:
22086  */
22087  goto __pyx_L13;
22088  }
22089 
22090  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":827
22091  * # Cython ignores struct boundary information ("T{...}"),
22092  * # so don't output it
22093  * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<<
22094  * return f
22095  *
22096  */
22097  /*else*/ {
22098  __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_9 == ((char *)NULL))) __PYX_ERR(1, 827, __pyx_L1_error)
22099  __pyx_v_f = __pyx_t_9;
22100  }
22101  __pyx_L13:;
22102 
22103  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":772
22104  * cdef tuple fields
22105  *
22106  * for childname in descr.names: # <<<<<<<<<<<<<<
22107  * fields = descr.fields[childname]
22108  * child, new_offset = fields
22109  */
22110  }
22111  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22112 
22113  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":828
22114  * # so don't output it
22115  * f = _util_dtypestring(child, f, end, offset)
22116  * return f # <<<<<<<<<<<<<<
22117  *
22118  *
22119  */
22120  __pyx_r = __pyx_v_f;
22121  goto __pyx_L0;
22122 
22123  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":763
22124  * return ()
22125  *
22126  * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<<
22127  * # Recursive utility function used in __getbuffer__ to get format
22128  * # string. The new location in the format string is returned.
22129  */
22130 
22131  /* function exit code */
22132  __pyx_L1_error:;
22133  __Pyx_XDECREF(__pyx_t_1);
22134  __Pyx_XDECREF(__pyx_t_3);
22135  __Pyx_XDECREF(__pyx_t_4);
22136  __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename);
22137  __pyx_r = NULL;
22138  __pyx_L0:;
22139  __Pyx_XDECREF((PyObject *)__pyx_v_child);
22140  __Pyx_XDECREF(__pyx_v_fields);
22141  __Pyx_XDECREF(__pyx_v_childname);
22142  __Pyx_XDECREF(__pyx_v_new_offset);
22143  __Pyx_XDECREF(__pyx_v_t);
22144  __Pyx_RefNannyFinishContext();
22145  return __pyx_r;
22146 }
22147 
22148 /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":943
22149  * int _import_umath() except -1
22150  *
22151  * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
22152  * Py_INCREF(base) # important to do this before stealing the reference below!
22153  * PyArray_SetBaseObject(arr, base)
22154  */
22155 
22156 static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
22157  __Pyx_RefNannyDeclarations
22158  __Pyx_RefNannySetupContext("set_array_base", 0);
22159 
22160  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":944
22161  *
22162  * cdef inline void set_array_base(ndarray arr, object base):
22163  * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<<
22164  * PyArray_SetBaseObject(arr, base)
22165  *
22166  */
22167  Py_INCREF(__pyx_v_base);
22168 
22169  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":945
22170  * cdef inline void set_array_base(ndarray arr, object base):
22171  * Py_INCREF(base) # important to do this before stealing the reference below!
22172  * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<<
22173  *
22174  * cdef inline object get_array_base(ndarray arr):
22175  */
22176  (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base));
22177 
22178  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":943
22179  * int _import_umath() except -1
22180  *
22181  * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
22182  * Py_INCREF(base) # important to do this before stealing the reference below!
22183  * PyArray_SetBaseObject(arr, base)
22184  */
22185 
22186  /* function exit code */
22187  __Pyx_RefNannyFinishContext();
22188 }
22189 
22190 /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":947
22191  * PyArray_SetBaseObject(arr, base)
22192  *
22193  * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
22194  * base = PyArray_BASE(arr)
22195  * if base is NULL:
22196  */
22197 
22198 static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
22199  PyObject *__pyx_v_base;
22200  PyObject *__pyx_r = NULL;
22201  __Pyx_RefNannyDeclarations
22202  int __pyx_t_1;
22203  __Pyx_RefNannySetupContext("get_array_base", 0);
22204 
22205  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":948
22206  *
22207  * cdef inline object get_array_base(ndarray arr):
22208  * base = PyArray_BASE(arr) # <<<<<<<<<<<<<<
22209  * if base is NULL:
22210  * return None
22211  */
22212  __pyx_v_base = PyArray_BASE(__pyx_v_arr);
22213 
22214  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":949
22215  * cdef inline object get_array_base(ndarray arr):
22216  * base = PyArray_BASE(arr)
22217  * if base is NULL: # <<<<<<<<<<<<<<
22218  * return None
22219  * return <object>base
22220  */
22221  __pyx_t_1 = ((__pyx_v_base == NULL) != 0);
22222  if (__pyx_t_1) {
22223 
22224  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":950
22225  * base = PyArray_BASE(arr)
22226  * if base is NULL:
22227  * return None # <<<<<<<<<<<<<<
22228  * return <object>base
22229  *
22230  */
22231  __Pyx_XDECREF(__pyx_r);
22232  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
22233  goto __pyx_L0;
22234 
22235  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":949
22236  * cdef inline object get_array_base(ndarray arr):
22237  * base = PyArray_BASE(arr)
22238  * if base is NULL: # <<<<<<<<<<<<<<
22239  * return None
22240  * return <object>base
22241  */
22242  }
22243 
22244  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":951
22245  * if base is NULL:
22246  * return None
22247  * return <object>base # <<<<<<<<<<<<<<
22248  *
22249  * # Versions of the import_* functions which are more suitable for
22250  */
22251  __Pyx_XDECREF(__pyx_r);
22252  __Pyx_INCREF(((PyObject *)__pyx_v_base));
22253  __pyx_r = ((PyObject *)__pyx_v_base);
22254  goto __pyx_L0;
22255 
22256  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":947
22257  * PyArray_SetBaseObject(arr, base)
22258  *
22259  * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
22260  * base = PyArray_BASE(arr)
22261  * if base is NULL:
22262  */
22263 
22264  /* function exit code */
22265  __pyx_L0:;
22266  __Pyx_XGIVEREF(__pyx_r);
22267  __Pyx_RefNannyFinishContext();
22268  return __pyx_r;
22269 }
22270 
22271 /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":955
22272  * # Versions of the import_* functions which are more suitable for
22273  * # Cython code.
22274  * cdef inline int import_array() except -1: # <<<<<<<<<<<<<<
22275  * try:
22276  * __pyx_import_array()
22277  */
22278 
22279 static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) {
22280  int __pyx_r;
22281  __Pyx_RefNannyDeclarations
22282  PyObject *__pyx_t_1 = NULL;
22283  PyObject *__pyx_t_2 = NULL;
22284  PyObject *__pyx_t_3 = NULL;
22285  int __pyx_t_4;
22286  PyObject *__pyx_t_5 = NULL;
22287  PyObject *__pyx_t_6 = NULL;
22288  PyObject *__pyx_t_7 = NULL;
22289  PyObject *__pyx_t_8 = NULL;
22290  int __pyx_lineno = 0;
22291  const char *__pyx_filename = NULL;
22292  int __pyx_clineno = 0;
22293  __Pyx_RefNannySetupContext("import_array", 0);
22294 
22295  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":956
22296  * # Cython code.
22297  * cdef inline int import_array() except -1:
22298  * try: # <<<<<<<<<<<<<<
22299  * __pyx_import_array()
22300  * except Exception:
22301  */
22302  {
22303  __Pyx_PyThreadState_declare
22304  __Pyx_PyThreadState_assign
22305  __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
22306  __Pyx_XGOTREF(__pyx_t_1);
22307  __Pyx_XGOTREF(__pyx_t_2);
22308  __Pyx_XGOTREF(__pyx_t_3);
22309  /*try:*/ {
22310 
22311  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":957
22312  * cdef inline int import_array() except -1:
22313  * try:
22314  * __pyx_import_array() # <<<<<<<<<<<<<<
22315  * except Exception:
22316  * raise ImportError("numpy.core.multiarray failed to import")
22317  */
22318  __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 957, __pyx_L3_error)
22319 
22320  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":956
22321  * # Cython code.
22322  * cdef inline int import_array() except -1:
22323  * try: # <<<<<<<<<<<<<<
22324  * __pyx_import_array()
22325  * except Exception:
22326  */
22327  }
22328  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
22329  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
22330  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
22331  goto __pyx_L8_try_end;
22332  __pyx_L3_error:;
22333 
22334  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":958
22335  * try:
22336  * __pyx_import_array()
22337  * except Exception: # <<<<<<<<<<<<<<
22338  * raise ImportError("numpy.core.multiarray failed to import")
22339  *
22340  */
22341  __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
22342  if (__pyx_t_4) {
22343  __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
22344  if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 958, __pyx_L5_except_error)
22345  __Pyx_GOTREF(__pyx_t_5);
22346  __Pyx_GOTREF(__pyx_t_6);
22347  __Pyx_GOTREF(__pyx_t_7);
22348 
22349  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":959
22350  * __pyx_import_array()
22351  * except Exception:
22352  * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<<
22353  *
22354  * cdef inline int import_umath() except -1:
22355  */
22356  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 959, __pyx_L5_except_error)
22357  __Pyx_GOTREF(__pyx_t_8);
22358  __Pyx_Raise(__pyx_t_8, 0, 0, 0);
22359  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
22360  __PYX_ERR(1, 959, __pyx_L5_except_error)
22361  }
22362  goto __pyx_L5_except_error;
22363  __pyx_L5_except_error:;
22364 
22365  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":956
22366  * # Cython code.
22367  * cdef inline int import_array() except -1:
22368  * try: # <<<<<<<<<<<<<<
22369  * __pyx_import_array()
22370  * except Exception:
22371  */
22372  __Pyx_XGIVEREF(__pyx_t_1);
22373  __Pyx_XGIVEREF(__pyx_t_2);
22374  __Pyx_XGIVEREF(__pyx_t_3);
22375  __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
22376  goto __pyx_L1_error;
22377  __pyx_L8_try_end:;
22378  }
22379 
22380  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":955
22381  * # Versions of the import_* functions which are more suitable for
22382  * # Cython code.
22383  * cdef inline int import_array() except -1: # <<<<<<<<<<<<<<
22384  * try:
22385  * __pyx_import_array()
22386  */
22387 
22388  /* function exit code */
22389  __pyx_r = 0;
22390  goto __pyx_L0;
22391  __pyx_L1_error:;
22392  __Pyx_XDECREF(__pyx_t_5);
22393  __Pyx_XDECREF(__pyx_t_6);
22394  __Pyx_XDECREF(__pyx_t_7);
22395  __Pyx_XDECREF(__pyx_t_8);
22396  __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
22397  __pyx_r = -1;
22398  __pyx_L0:;
22399  __Pyx_RefNannyFinishContext();
22400  return __pyx_r;
22401 }
22402 
22403 /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":961
22404  * raise ImportError("numpy.core.multiarray failed to import")
22405  *
22406  * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<<
22407  * try:
22408  * _import_umath()
22409  */
22410 
22411 static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) {
22412  int __pyx_r;
22413  __Pyx_RefNannyDeclarations
22414  PyObject *__pyx_t_1 = NULL;
22415  PyObject *__pyx_t_2 = NULL;
22416  PyObject *__pyx_t_3 = NULL;
22417  int __pyx_t_4;
22418  PyObject *__pyx_t_5 = NULL;
22419  PyObject *__pyx_t_6 = NULL;
22420  PyObject *__pyx_t_7 = NULL;
22421  PyObject *__pyx_t_8 = NULL;
22422  int __pyx_lineno = 0;
22423  const char *__pyx_filename = NULL;
22424  int __pyx_clineno = 0;
22425  __Pyx_RefNannySetupContext("import_umath", 0);
22426 
22427  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":962
22428  *
22429  * cdef inline int import_umath() except -1:
22430  * try: # <<<<<<<<<<<<<<
22431  * _import_umath()
22432  * except Exception:
22433  */
22434  {
22435  __Pyx_PyThreadState_declare
22436  __Pyx_PyThreadState_assign
22437  __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
22438  __Pyx_XGOTREF(__pyx_t_1);
22439  __Pyx_XGOTREF(__pyx_t_2);
22440  __Pyx_XGOTREF(__pyx_t_3);
22441  /*try:*/ {
22442 
22443  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":963
22444  * cdef inline int import_umath() except -1:
22445  * try:
22446  * _import_umath() # <<<<<<<<<<<<<<
22447  * except Exception:
22448  * raise ImportError("numpy.core.umath failed to import")
22449  */
22450  __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 963, __pyx_L3_error)
22451 
22452  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":962
22453  *
22454  * cdef inline int import_umath() except -1:
22455  * try: # <<<<<<<<<<<<<<
22456  * _import_umath()
22457  * except Exception:
22458  */
22459  }
22460  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
22461  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
22462  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
22463  goto __pyx_L8_try_end;
22464  __pyx_L3_error:;
22465 
22466  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":964
22467  * try:
22468  * _import_umath()
22469  * except Exception: # <<<<<<<<<<<<<<
22470  * raise ImportError("numpy.core.umath failed to import")
22471  *
22472  */
22473  __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
22474  if (__pyx_t_4) {
22475  __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
22476  if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 964, __pyx_L5_except_error)
22477  __Pyx_GOTREF(__pyx_t_5);
22478  __Pyx_GOTREF(__pyx_t_6);
22479  __Pyx_GOTREF(__pyx_t_7);
22480 
22481  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":965
22482  * _import_umath()
22483  * except Exception:
22484  * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
22485  *
22486  * cdef inline int import_ufunc() except -1:
22487  */
22488  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 965, __pyx_L5_except_error)
22489  __Pyx_GOTREF(__pyx_t_8);
22490  __Pyx_Raise(__pyx_t_8, 0, 0, 0);
22491  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
22492  __PYX_ERR(1, 965, __pyx_L5_except_error)
22493  }
22494  goto __pyx_L5_except_error;
22495  __pyx_L5_except_error:;
22496 
22497  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":962
22498  *
22499  * cdef inline int import_umath() except -1:
22500  * try: # <<<<<<<<<<<<<<
22501  * _import_umath()
22502  * except Exception:
22503  */
22504  __Pyx_XGIVEREF(__pyx_t_1);
22505  __Pyx_XGIVEREF(__pyx_t_2);
22506  __Pyx_XGIVEREF(__pyx_t_3);
22507  __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
22508  goto __pyx_L1_error;
22509  __pyx_L8_try_end:;
22510  }
22511 
22512  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":961
22513  * raise ImportError("numpy.core.multiarray failed to import")
22514  *
22515  * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<<
22516  * try:
22517  * _import_umath()
22518  */
22519 
22520  /* function exit code */
22521  __pyx_r = 0;
22522  goto __pyx_L0;
22523  __pyx_L1_error:;
22524  __Pyx_XDECREF(__pyx_t_5);
22525  __Pyx_XDECREF(__pyx_t_6);
22526  __Pyx_XDECREF(__pyx_t_7);
22527  __Pyx_XDECREF(__pyx_t_8);
22528  __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
22529  __pyx_r = -1;
22530  __pyx_L0:;
22531  __Pyx_RefNannyFinishContext();
22532  return __pyx_r;
22533 }
22534 
22535 /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":967
22536  * raise ImportError("numpy.core.umath failed to import")
22537  *
22538  * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
22539  * try:
22540  * _import_umath()
22541  */
22542 
22543 static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) {
22544  int __pyx_r;
22545  __Pyx_RefNannyDeclarations
22546  PyObject *__pyx_t_1 = NULL;
22547  PyObject *__pyx_t_2 = NULL;
22548  PyObject *__pyx_t_3 = NULL;
22549  int __pyx_t_4;
22550  PyObject *__pyx_t_5 = NULL;
22551  PyObject *__pyx_t_6 = NULL;
22552  PyObject *__pyx_t_7 = NULL;
22553  PyObject *__pyx_t_8 = NULL;
22554  int __pyx_lineno = 0;
22555  const char *__pyx_filename = NULL;
22556  int __pyx_clineno = 0;
22557  __Pyx_RefNannySetupContext("import_ufunc", 0);
22558 
22559  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":968
22560  *
22561  * cdef inline int import_ufunc() except -1:
22562  * try: # <<<<<<<<<<<<<<
22563  * _import_umath()
22564  * except Exception:
22565  */
22566  {
22567  __Pyx_PyThreadState_declare
22568  __Pyx_PyThreadState_assign
22569  __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
22570  __Pyx_XGOTREF(__pyx_t_1);
22571  __Pyx_XGOTREF(__pyx_t_2);
22572  __Pyx_XGOTREF(__pyx_t_3);
22573  /*try:*/ {
22574 
22575  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":969
22576  * cdef inline int import_ufunc() except -1:
22577  * try:
22578  * _import_umath() # <<<<<<<<<<<<<<
22579  * except Exception:
22580  * raise ImportError("numpy.core.umath failed to import")
22581  */
22582  __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 969, __pyx_L3_error)
22583 
22584  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":968
22585  *
22586  * cdef inline int import_ufunc() except -1:
22587  * try: # <<<<<<<<<<<<<<
22588  * _import_umath()
22589  * except Exception:
22590  */
22591  }
22592  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
22593  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
22594  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
22595  goto __pyx_L8_try_end;
22596  __pyx_L3_error:;
22597 
22598  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":970
22599  * try:
22600  * _import_umath()
22601  * except Exception: # <<<<<<<<<<<<<<
22602  * raise ImportError("numpy.core.umath failed to import")
22603  *
22604  */
22605  __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
22606  if (__pyx_t_4) {
22607  __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
22608  if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 970, __pyx_L5_except_error)
22609  __Pyx_GOTREF(__pyx_t_5);
22610  __Pyx_GOTREF(__pyx_t_6);
22611  __Pyx_GOTREF(__pyx_t_7);
22612 
22613  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":971
22614  * _import_umath()
22615  * except Exception:
22616  * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
22617  *
22618  * cdef extern from *:
22619  */
22620  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 971, __pyx_L5_except_error)
22621  __Pyx_GOTREF(__pyx_t_8);
22622  __Pyx_Raise(__pyx_t_8, 0, 0, 0);
22623  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
22624  __PYX_ERR(1, 971, __pyx_L5_except_error)
22625  }
22626  goto __pyx_L5_except_error;
22627  __pyx_L5_except_error:;
22628 
22629  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":968
22630  *
22631  * cdef inline int import_ufunc() except -1:
22632  * try: # <<<<<<<<<<<<<<
22633  * _import_umath()
22634  * except Exception:
22635  */
22636  __Pyx_XGIVEREF(__pyx_t_1);
22637  __Pyx_XGIVEREF(__pyx_t_2);
22638  __Pyx_XGIVEREF(__pyx_t_3);
22639  __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
22640  goto __pyx_L1_error;
22641  __pyx_L8_try_end:;
22642  }
22643 
22644  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":967
22645  * raise ImportError("numpy.core.umath failed to import")
22646  *
22647  * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
22648  * try:
22649  * _import_umath()
22650  */
22651 
22652  /* function exit code */
22653  __pyx_r = 0;
22654  goto __pyx_L0;
22655  __pyx_L1_error:;
22656  __Pyx_XDECREF(__pyx_t_5);
22657  __Pyx_XDECREF(__pyx_t_6);
22658  __Pyx_XDECREF(__pyx_t_7);
22659  __Pyx_XDECREF(__pyx_t_8);
22660  __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
22661  __pyx_r = -1;
22662  __pyx_L0:;
22663  __Pyx_RefNannyFinishContext();
22664  return __pyx_r;
22665 }
22666 
22667 static PyMethodDef __pyx_methods[] = {
22668  {0, 0, 0, 0}
22669 };
22670 
22671 #if PY_MAJOR_VERSION >= 3
22672 #if CYTHON_PEP489_MULTI_PHASE_INIT
22673 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
22674 static int __pyx_pymod_exec_subsurfaceTransportFunctions(PyObject* module); /*proto*/
22675 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
22676  {Py_mod_create, (void*)__pyx_pymod_create},
22677  {Py_mod_exec, (void*)__pyx_pymod_exec_subsurfaceTransportFunctions},
22678  {0, NULL}
22679 };
22680 #endif
22681 
22682 static struct PyModuleDef __pyx_moduledef = {
22683  PyModuleDef_HEAD_INIT,
22684  "subsurfaceTransportFunctions",
22685  0, /* m_doc */
22686  #if CYTHON_PEP489_MULTI_PHASE_INIT
22687  0, /* m_size */
22688  #else
22689  -1, /* m_size */
22690  #endif
22691  __pyx_methods /* m_methods */,
22692  #if CYTHON_PEP489_MULTI_PHASE_INIT
22693  __pyx_moduledef_slots, /* m_slots */
22694  #else
22695  NULL, /* m_reload */
22696  #endif
22697  NULL, /* m_traverse */
22698  NULL, /* m_clear */
22699  NULL /* m_free */
22700 };
22701 #endif
22702 #ifndef CYTHON_SMALL_CODE
22703 #if defined(__clang__)
22704  #define CYTHON_SMALL_CODE
22705 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
22706  #define CYTHON_SMALL_CODE __attribute__((cold))
22707 #else
22708  #define CYTHON_SMALL_CODE
22709 #endif
22710 #endif
22711 
22712 static __Pyx_StringTabEntry __pyx_string_tab[] = {
22713  {&__pyx_n_s_DKWr_DpsiC, __pyx_k_DKWr_DpsiC, sizeof(__pyx_k_DKWr_DpsiC), 0, 0, 1, 1},
22714  {&__pyx_n_s_DsBar_DpsiC, __pyx_k_DsBar_DpsiC, sizeof(__pyx_k_DsBar_DpsiC), 0, 0, 1, 1},
22715  {&__pyx_n_s_DthetaW_DpsiC, __pyx_k_DthetaW_DpsiC, sizeof(__pyx_k_DthetaW_DpsiC), 0, 0, 1, 1},
22716  {&__pyx_n_s_DvBar_DpsiC, __pyx_k_DvBar_DpsiC, sizeof(__pyx_k_DvBar_DpsiC), 0, 0, 1, 1},
22717  {&__pyx_kp_u_Format_string_allocated_too_shor, __pyx_k_Format_string_allocated_too_shor, sizeof(__pyx_k_Format_string_allocated_too_shor), 0, 1, 0, 0},
22718  {&__pyx_kp_u_Format_string_allocated_too_shor_2, __pyx_k_Format_string_allocated_too_shor_2, sizeof(__pyx_k_Format_string_allocated_too_shor_2), 0, 1, 0, 0},
22719  {&__pyx_n_s_I, __pyx_k_I, sizeof(__pyx_k_I), 0, 0, 1, 1},
22720  {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
22721  {&__pyx_n_s_J, __pyx_k_J, sizeof(__pyx_k_J), 0, 0, 1, 1},
22722  {&__pyx_n_s_KWr, __pyx_k_KWr, sizeof(__pyx_k_KWr), 0, 0, 1, 1},
22723  {&__pyx_n_s_KWs, __pyx_k_KWs, sizeof(__pyx_k_KWs), 0, 0, 1, 1},
22724  {&__pyx_kp_u_Non_native_byte_order_not_suppor, __pyx_k_Non_native_byte_order_not_suppor, sizeof(__pyx_k_Non_native_byte_order_not_suppor), 0, 1, 0, 0},
22725  {&__pyx_n_s_RE_NCP1_evaluateElementCoefficie, __pyx_k_RE_NCP1_evaluateElementCoefficie, sizeof(__pyx_k_RE_NCP1_evaluateElementCoefficie), 0, 0, 1, 1},
22726  {&__pyx_n_s_RE_NCP1_evaluateElementCoefficie_2, __pyx_k_RE_NCP1_evaluateElementCoefficie_2, sizeof(__pyx_k_RE_NCP1_evaluateElementCoefficie_2), 0, 0, 1, 1},
22727  {&__pyx_n_s_RE_NCP1_getElementJacobian, __pyx_k_RE_NCP1_getElementJacobian, sizeof(__pyx_k_RE_NCP1_getElementJacobian), 0, 0, 1, 1},
22728  {&__pyx_n_s_RE_NCP1_getElementResidual, __pyx_k_RE_NCP1_getElementResidual, sizeof(__pyx_k_RE_NCP1_getElementResidual), 0, 0, 1, 1},
22729  {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
22730  {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
22731  {&__pyx_n_s_a_avg, __pyx_k_a_avg, sizeof(__pyx_k_a_avg), 0, 0, 1, 1},
22732  {&__pyx_n_s_a_eN, __pyx_k_a_eN, sizeof(__pyx_k_a_eN), 0, 0, 1, 1},
22733  {&__pyx_n_s_a_neig, __pyx_k_a_neig, sizeof(__pyx_k_a_neig), 0, 0, 1, 1},
22734  {&__pyx_n_s_a_up, __pyx_k_a_up, sizeof(__pyx_k_a_up), 0, 0, 1, 1},
22735  {&__pyx_n_s_alpha, __pyx_k_alpha, sizeof(__pyx_k_alpha), 0, 0, 1, 1},
22736  {&__pyx_n_s_beta, __pyx_k_beta, sizeof(__pyx_k_beta), 0, 0, 1, 1},
22737  {&__pyx_n_s_calculateNormalFlux, __pyx_k_calculateNormalFlux, sizeof(__pyx_k_calculateNormalFlux), 0, 0, 1, 1},
22738  {&__pyx_n_s_characteristic_velocity, __pyx_k_characteristic_velocity, sizeof(__pyx_k_characteristic_velocity), 0, 0, 1, 1},
22739  {&__pyx_n_s_characteristic_velocity_dofs, __pyx_k_characteristic_velocity_dofs, sizeof(__pyx_k_characteristic_velocity_dofs), 0, 0, 1, 1},
22740  {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
22741  {&__pyx_n_s_clock, __pyx_k_clock, sizeof(__pyx_k_clock), 0, 0, 1, 1},
22742  {&__pyx_n_s_colind, __pyx_k_colind, sizeof(__pyx_k_colind), 0, 0, 1, 1},
22743  {&__pyx_n_s_computeSimpleCharacteristicVeloc, __pyx_k_computeSimpleCharacteristicVeloc, sizeof(__pyx_k_computeSimpleCharacteristicVeloc), 0, 0, 1, 1},
22744  {&__pyx_n_s_computeSimpleCharacteristicVeloc_2, __pyx_k_computeSimpleCharacteristicVeloc_2, sizeof(__pyx_k_computeSimpleCharacteristicVeloc_2), 0, 0, 1, 1},
22745  {&__pyx_n_s_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 0, 1, 1},
22746  {&__pyx_n_s_dS, __pyx_k_dS, sizeof(__pyx_k_dS), 0, 0, 1, 1},
22747  {&__pyx_n_s_dV, __pyx_k_dV, sizeof(__pyx_k_dV), 0, 0, 1, 1},
22748  {&__pyx_n_s_denom, __pyx_k_denom, sizeof(__pyx_k_denom), 0, 0, 1, 1},
22749  {&__pyx_n_s_df, __pyx_k_df, sizeof(__pyx_k_df), 0, 0, 1, 1},
22750  {&__pyx_n_s_df_dofs, __pyx_k_df_dofs, sizeof(__pyx_k_df_dofs), 0, 0, 1, 1},
22751  {&__pyx_n_s_dkr_up, __pyx_k_dkr_up, sizeof(__pyx_k_dkr_up), 0, 0, 1, 1},
22752  {&__pyx_n_s_dm, __pyx_k_dm, sizeof(__pyx_k_dm), 0, 0, 1, 1},
22753  {&__pyx_n_s_dmt, __pyx_k_dmt, sizeof(__pyx_k_dmt), 0, 0, 1, 1},
22754  {&__pyx_n_s_dmtj_avg, __pyx_k_dmtj_avg, sizeof(__pyx_k_dmtj_avg), 0, 0, 1, 1},
22755  {&__pyx_n_s_dot, __pyx_k_dot, sizeof(__pyx_k_dot), 0, 0, 1, 1},
22756  {&__pyx_n_s_drhom, __pyx_k_drhom, sizeof(__pyx_k_drhom), 0, 0, 1, 1},
22757  {&__pyx_n_s_eN, __pyx_k_eN, sizeof(__pyx_k_eN), 0, 0, 1, 1},
22758  {&__pyx_n_s_eN_left, __pyx_k_eN_left, sizeof(__pyx_k_eN_left), 0, 0, 1, 1},
22759  {&__pyx_n_s_eN_neighbor, __pyx_k_eN_neighbor, sizeof(__pyx_k_eN_neighbor), 0, 0, 1, 1},
22760  {&__pyx_n_s_eN_right, __pyx_k_eN_right, sizeof(__pyx_k_eN_right), 0, 0, 1, 1},
22761  {&__pyx_n_s_ebN, __pyx_k_ebN, sizeof(__pyx_k_ebN), 0, 0, 1, 1},
22762  {&__pyx_n_s_ebNE, __pyx_k_ebNE, sizeof(__pyx_k_ebNE), 0, 0, 1, 1},
22763  {&__pyx_n_s_ebN_local, __pyx_k_ebN_local, sizeof(__pyx_k_ebN_local), 0, 0, 1, 1},
22764  {&__pyx_n_s_ebq_global_vals, __pyx_k_ebq_global_vals, sizeof(__pyx_k_ebq_global_vals), 0, 0, 1, 1},
22765  {&__pyx_n_s_ebq_vals, __pyx_k_ebq_vals, sizeof(__pyx_k_ebq_vals), 0, 0, 1, 1},
22766  {&__pyx_n_s_elementBarycentersArray, __pyx_k_elementBarycentersArray, sizeof(__pyx_k_elementBarycentersArray), 0, 0, 1, 1},
22767  {&__pyx_n_s_elementBoundariesArray, __pyx_k_elementBoundariesArray, sizeof(__pyx_k_elementBoundariesArray), 0, 0, 1, 1},
22768  {&__pyx_n_s_elementBoundaryElementsArray, __pyx_k_elementBoundaryElementsArray, sizeof(__pyx_k_elementBoundaryElementsArray), 0, 0, 1, 1},
22769  {&__pyx_n_s_elementBoundaryMaterialTypes, __pyx_k_elementBoundaryMaterialTypes, sizeof(__pyx_k_elementBoundaryMaterialTypes), 0, 0, 1, 1},
22770  {&__pyx_n_s_elementBoundaryTypes, __pyx_k_elementBoundaryTypes, sizeof(__pyx_k_elementBoundaryTypes), 0, 0, 1, 1},
22771  {&__pyx_n_s_elementJacobian, __pyx_k_elementJacobian, sizeof(__pyx_k_elementJacobian), 0, 0, 1, 1},
22772  {&__pyx_n_s_elementMaterialTypes, __pyx_k_elementMaterialTypes, sizeof(__pyx_k_elementMaterialTypes), 0, 0, 1, 1},
22773  {&__pyx_n_s_elementNeighborsArray, __pyx_k_elementNeighborsArray, sizeof(__pyx_k_elementNeighborsArray), 0, 0, 1, 1},
22774  {&__pyx_n_s_elementResidual, __pyx_k_elementResidual, sizeof(__pyx_k_elementResidual), 0, 0, 1, 1},
22775  {&__pyx_n_s_evaluateScalarMaterialFunctionOv, __pyx_k_evaluateScalarMaterialFunctionOv, sizeof(__pyx_k_evaluateScalarMaterialFunctionOv), 0, 0, 1, 1},
22776  {&__pyx_n_s_evaluateScalarMaterialFunctionOv_2, __pyx_k_evaluateScalarMaterialFunctionOv_2, sizeof(__pyx_k_evaluateScalarMaterialFunctionOv_2), 0, 0, 1, 1},
22777  {&__pyx_n_s_evaluateScalarMaterialFunctionOv_3, __pyx_k_evaluateScalarMaterialFunctionOv_3, sizeof(__pyx_k_evaluateScalarMaterialFunctionOv_3), 0, 0, 1, 1},
22778  {&__pyx_n_s_evaluateSparseTensorMaterialFunc, __pyx_k_evaluateSparseTensorMaterialFunc, sizeof(__pyx_k_evaluateSparseTensorMaterialFunc), 0, 0, 1, 1},
22779  {&__pyx_n_s_evaluateSparseTensorMaterialFunc_2, __pyx_k_evaluateSparseTensorMaterialFunc_2, sizeof(__pyx_k_evaluateSparseTensorMaterialFunc_2), 0, 0, 1, 1},
22780  {&__pyx_n_s_evaluateVectorMaterialFunctionOv, __pyx_k_evaluateVectorMaterialFunctionOv, sizeof(__pyx_k_evaluateVectorMaterialFunctionOv), 0, 0, 1, 1},
22781  {&__pyx_n_s_exteriorElementBoundariesArray, __pyx_k_exteriorElementBoundariesArray, sizeof(__pyx_k_exteriorElementBoundariesArray), 0, 0, 1, 1},
22782  {&__pyx_n_s_exteriorElementBoundaryMaterialT, __pyx_k_exteriorElementBoundaryMaterialT, sizeof(__pyx_k_exteriorElementBoundaryMaterialT), 0, 0, 1, 1},
22783  {&__pyx_n_s_f_up, __pyx_k_f_up, sizeof(__pyx_k_f_up), 0, 0, 1, 1},
22784  {&__pyx_n_s_flat, __pyx_k_flat, sizeof(__pyx_k_flat), 0, 0, 1, 1},
22785  {&__pyx_n_s_flux, __pyx_k_flux, sizeof(__pyx_k_flux), 0, 0, 1, 1},
22786  {&__pyx_n_s_gravity, __pyx_k_gravity, sizeof(__pyx_k_gravity), 0, 0, 1, 1},
22787  {&__pyx_n_s_helicalElementVelocityEval3, __pyx_k_helicalElementVelocityEval3, sizeof(__pyx_k_helicalElementVelocityEval3), 0, 0, 1, 1},
22788  {&__pyx_n_s_helicalElementVelocityEval4, __pyx_k_helicalElementVelocityEval4, sizeof(__pyx_k_helicalElementVelocityEval4), 0, 0, 1, 1},
22789  {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
22790  {&__pyx_n_s_ii, __pyx_k_ii, sizeof(__pyx_k_ii), 0, 0, 1, 1},
22791  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
22792  {&__pyx_n_s_integral, __pyx_k_integral, sizeof(__pyx_k_integral), 0, 0, 1, 1},
22793  {&__pyx_n_s_j, __pyx_k_j, sizeof(__pyx_k_j), 0, 0, 1, 1},
22794  {&__pyx_n_s_jacobian_weak_residual, __pyx_k_jacobian_weak_residual, sizeof(__pyx_k_jacobian_weak_residual), 0, 0, 1, 1},
22795  {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1},
22796  {&__pyx_n_s_kb, __pyx_k_kb, sizeof(__pyx_k_kb), 0, 0, 1, 1},
22797  {&__pyx_n_s_kr_eN, __pyx_k_kr_eN, sizeof(__pyx_k_kr_eN), 0, 0, 1, 1},
22798  {&__pyx_n_s_kr_neig, __pyx_k_kr_neig, sizeof(__pyx_k_kr_neig), 0, 0, 1, 1},
22799  {&__pyx_n_s_l2g, __pyx_k_l2g, sizeof(__pyx_k_l2g), 0, 0, 1, 1},
22800  {&__pyx_n_s_m, __pyx_k_m, sizeof(__pyx_k_m), 0, 0, 1, 1},
22801  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
22802  {&__pyx_n_s_matID, __pyx_k_matID, sizeof(__pyx_k_matID), 0, 0, 1, 1},
22803  {&__pyx_n_s_matID_neig, __pyx_k_matID_neig, sizeof(__pyx_k_matID_neig), 0, 0, 1, 1},
22804  {&__pyx_n_s_material, __pyx_k_material, sizeof(__pyx_k_material), 0, 0, 1, 1},
22805  {&__pyx_n_s_material_functions, __pyx_k_material_functions, sizeof(__pyx_k_material_functions), 0, 0, 1, 1},
22806  {&__pyx_n_s_material_left, __pyx_k_material_left, sizeof(__pyx_k_material_left), 0, 0, 1, 1},
22807  {&__pyx_n_s_material_right, __pyx_k_material_right, sizeof(__pyx_k_material_right), 0, 0, 1, 1},
22808  {&__pyx_n_s_mt, __pyx_k_mt, sizeof(__pyx_k_mt), 0, 0, 1, 1},
22809  {&__pyx_n_s_mt_avg, __pyx_k_mt_avg, sizeof(__pyx_k_mt_avg), 0, 0, 1, 1},
22810  {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1},
22811  {&__pyx_n_s_nAvgWeight, __pyx_k_nAvgWeight, sizeof(__pyx_k_nAvgWeight), 0, 0, 1, 1},
22812  {&__pyx_n_s_nDOF_test_element, __pyx_k_nDOF_test_element, sizeof(__pyx_k_nDOF_test_element), 0, 0, 1, 1},
22813  {&__pyx_n_s_nDOF_trial_element, __pyx_k_nDOF_trial_element, sizeof(__pyx_k_nDOF_trial_element), 0, 0, 1, 1},
22814  {&__pyx_n_s_nElementBoundaries_element, __pyx_k_nElementBoundaries_element, sizeof(__pyx_k_nElementBoundaries_element), 0, 0, 1, 1},
22815  {&__pyx_n_s_nElementBoundaries_global, __pyx_k_nElementBoundaries_global, sizeof(__pyx_k_nElementBoundaries_global), 0, 0, 1, 1},
22816  {&__pyx_n_s_nElements_global, __pyx_k_nElements_global, sizeof(__pyx_k_nElements_global), 0, 0, 1, 1},
22817  {&__pyx_n_s_nExteriorElementBoundaries_globa, __pyx_k_nExteriorElementBoundaries_globa, sizeof(__pyx_k_nExteriorElementBoundaries_globa), 0, 0, 1, 1},
22818  {&__pyx_n_s_nSpace, __pyx_k_nSpace, sizeof(__pyx_k_nSpace), 0, 0, 1, 1},
22819  {&__pyx_n_s_nSpace2, __pyx_k_nSpace2, sizeof(__pyx_k_nSpace2), 0, 0, 1, 1},
22820  {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
22821  {&__pyx_n_s_nd, __pyx_k_nd, sizeof(__pyx_k_nd), 0, 0, 1, 1},
22822  {&__pyx_n_s_nnz, __pyx_k_nnz, sizeof(__pyx_k_nnz), 0, 0, 1, 1},
22823  {&__pyx_n_s_numer, __pyx_k_numer, sizeof(__pyx_k_numer), 0, 0, 1, 1},
22824  {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
22825  {&__pyx_kp_s_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 0, 1, 0},
22826  {&__pyx_kp_s_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 0, 1, 0},
22827  {&__pyx_n_s_omega_e, __pyx_k_omega_e, sizeof(__pyx_k_omega_e), 0, 0, 1, 1},
22828  {&__pyx_n_s_one8, __pyx_k_one8, sizeof(__pyx_k_one8), 0, 0, 1, 1},
22829  {&__pyx_n_s_onePlus_pcBar_n, __pyx_k_onePlus_pcBar_n, sizeof(__pyx_k_onePlus_pcBar_n), 0, 0, 1, 1},
22830  {&__pyx_n_s_pcBar, __pyx_k_pcBar, sizeof(__pyx_k_pcBar), 0, 0, 1, 1},
22831  {&__pyx_n_s_pcBar_n, __pyx_k_pcBar_n, sizeof(__pyx_k_pcBar_n), 0, 0, 1, 1},
22832  {&__pyx_n_s_pcBar_nM1, __pyx_k_pcBar_nM1, sizeof(__pyx_k_pcBar_nM1), 0, 0, 1, 1},
22833  {&__pyx_n_s_pcBar_nM2, __pyx_k_pcBar_nM2, sizeof(__pyx_k_pcBar_nM2), 0, 0, 1, 1},
22834  {&__pyx_n_s_phi_eN, __pyx_k_phi_eN, sizeof(__pyx_k_phi_eN), 0, 0, 1, 1},
22835  {&__pyx_n_s_phi_neig, __pyx_k_phi_neig, sizeof(__pyx_k_phi_neig), 0, 0, 1, 1},
22836  {&__pyx_n_s_pi, __pyx_k_pi, sizeof(__pyx_k_pi), 0, 0, 1, 1},
22837  {&__pyx_n_s_picard, __pyx_k_picard, sizeof(__pyx_k_picard), 0, 0, 1, 1},
22838  {&__pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_k_proteus_subsurfaceTransportFunct, sizeof(__pyx_k_proteus_subsurfaceTransportFunct), 0, 0, 1, 0},
22839  {&__pyx_n_s_psiC, __pyx_k_psiC, sizeof(__pyx_k_psiC), 0, 0, 1, 1},
22840  {&__pyx_n_s_q, __pyx_k_q, sizeof(__pyx_k_q), 0, 0, 1, 1},
22841  {&__pyx_n_s_q_alin, __pyx_k_q_alin, sizeof(__pyx_k_q_alin), 0, 0, 1, 1},
22842  {&__pyx_n_s_q_detJ, __pyx_k_q_detJ, sizeof(__pyx_k_q_detJ), 0, 0, 1, 1},
22843  {&__pyx_n_s_q_dkr, __pyx_k_q_dkr, sizeof(__pyx_k_q_dkr), 0, 0, 1, 1},
22844  {&__pyx_n_s_q_dm, __pyx_k_q_dm, sizeof(__pyx_k_q_dm), 0, 0, 1, 1},
22845  {&__pyx_n_s_q_dmass, __pyx_k_q_dmass, sizeof(__pyx_k_q_dmass), 0, 0, 1, 1},
22846  {&__pyx_n_s_q_dmt, __pyx_k_q_dmt, sizeof(__pyx_k_q_dmt), 0, 0, 1, 1},
22847  {&__pyx_n_s_q_flin, __pyx_k_q_flin, sizeof(__pyx_k_q_flin), 0, 0, 1, 1},
22848  {&__pyx_n_s_q_grad_u, __pyx_k_q_grad_u, sizeof(__pyx_k_q_grad_u), 0, 0, 1, 1},
22849  {&__pyx_n_s_q_grad_v, __pyx_k_q_grad_v, sizeof(__pyx_k_q_grad_v), 0, 0, 1, 1},
22850  {&__pyx_n_s_q_grad_w, __pyx_k_q_grad_w, sizeof(__pyx_k_q_grad_w), 0, 0, 1, 1},
22851  {&__pyx_n_s_q_kr, __pyx_k_q_kr, sizeof(__pyx_k_q_kr), 0, 0, 1, 1},
22852  {&__pyx_n_s_q_kr_up, __pyx_k_q_kr_up, sizeof(__pyx_k_q_kr_up), 0, 0, 1, 1},
22853  {&__pyx_n_s_q_m, __pyx_k_q_m, sizeof(__pyx_k_q_m), 0, 0, 1, 1},
22854  {&__pyx_n_s_q_mass, __pyx_k_q_mass, sizeof(__pyx_k_q_mass), 0, 0, 1, 1},
22855  {&__pyx_n_s_q_mt, __pyx_k_q_mt, sizeof(__pyx_k_q_mt), 0, 0, 1, 1},
22856  {&__pyx_n_s_q_r, __pyx_k_q_r, sizeof(__pyx_k_q_r), 0, 0, 1, 1},
22857  {&__pyx_n_s_q_u, __pyx_k_q_u, sizeof(__pyx_k_q_u), 0, 0, 1, 1},
22858  {&__pyx_n_s_q_vals, __pyx_k_q_vals, sizeof(__pyx_k_q_vals), 0, 0, 1, 1},
22859  {&__pyx_n_s_q_x, __pyx_k_q_x, sizeof(__pyx_k_q_x), 0, 0, 1, 1},
22860  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
22861  {&__pyx_n_s_rho, __pyx_k_rho, sizeof(__pyx_k_rho), 0, 0, 1, 1},
22862  {&__pyx_n_s_rho2, __pyx_k_rho2, sizeof(__pyx_k_rho2), 0, 0, 1, 1},
22863  {&__pyx_n_s_rhom, __pyx_k_rhom, sizeof(__pyx_k_rhom), 0, 0, 1, 1},
22864  {&__pyx_n_s_rotatingGaussianElementVelocityE, __pyx_k_rotatingGaussianElementVelocityE, sizeof(__pyx_k_rotatingGaussianElementVelocityE), 0, 0, 1, 1},
22865  {&__pyx_n_s_rotatingGaussianElementVelocityE_2, __pyx_k_rotatingGaussianElementVelocityE_2, sizeof(__pyx_k_rotatingGaussianElementVelocityE_2), 0, 0, 1, 1},
22866  {&__pyx_n_s_rowptr, __pyx_k_rowptr, sizeof(__pyx_k_rowptr), 0, 0, 1, 1},
22867  {&__pyx_n_s_sBar, __pyx_k_sBar, sizeof(__pyx_k_sBar), 0, 0, 1, 1},
22868  {&__pyx_n_s_setElementBoundariesArray, __pyx_k_setElementBoundariesArray, sizeof(__pyx_k_setElementBoundariesArray), 0, 0, 1, 1},
22869  {&__pyx_n_s_setExteriorElementBoundaryTypes, __pyx_k_setExteriorElementBoundaryTypes, sizeof(__pyx_k_setExteriorElementBoundaryTypes), 0, 0, 1, 1},
22870  {&__pyx_n_s_setScalarMaterialFunctionOverEle, __pyx_k_setScalarMaterialFunctionOverEle, sizeof(__pyx_k_setScalarMaterialFunctionOverEle), 0, 0, 1, 1},
22871  {&__pyx_n_s_setScalarMaterialFunctionOverEle_2, __pyx_k_setScalarMaterialFunctionOverEle_2, sizeof(__pyx_k_setScalarMaterialFunctionOverEle_2), 0, 0, 1, 1},
22872  {&__pyx_n_s_setScalarMaterialFunctionOverGlo, __pyx_k_setScalarMaterialFunctionOverGlo, sizeof(__pyx_k_setScalarMaterialFunctionOverGlo), 0, 0, 1, 1},
22873  {&__pyx_n_s_setSparseTensorMaterialFunctionO, __pyx_k_setSparseTensorMaterialFunctionO, sizeof(__pyx_k_setSparseTensorMaterialFunctionO), 0, 0, 1, 1},
22874  {&__pyx_n_s_setSparseTensorMaterialFunctionO_2, __pyx_k_setSparseTensorMaterialFunctionO_2, sizeof(__pyx_k_setSparseTensorMaterialFunctionO_2), 0, 0, 1, 1},
22875  {&__pyx_n_s_setVectorMaterialFunctionOverEle, __pyx_k_setVectorMaterialFunctionOverEle, sizeof(__pyx_k_setVectorMaterialFunctionOverEle), 0, 0, 1, 1},
22876  {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1},
22877  {&__pyx_n_s_sqrt_sBar, __pyx_k_sqrt_sBar, sizeof(__pyx_k_sqrt_sBar), 0, 0, 1, 1},
22878  {&__pyx_n_s_subsurfaceTransportFunctions, __pyx_k_subsurfaceTransportFunctions, sizeof(__pyx_k_subsurfaceTransportFunctions), 0, 0, 1, 1},
22879  {&__pyx_n_s_sum, __pyx_k_sum, sizeof(__pyx_k_sum), 0, 0, 1, 1},
22880  {&__pyx_n_s_t, __pyx_k_t, sizeof(__pyx_k_t), 0, 0, 1, 1},
22881  {&__pyx_n_s_tForReversal, __pyx_k_tForReversal, sizeof(__pyx_k_tForReversal), 0, 0, 1, 1},
22882  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
22883  {&__pyx_n_s_thetaR, __pyx_k_thetaR, sizeof(__pyx_k_thetaR), 0, 0, 1, 1},
22884  {&__pyx_n_s_thetaS, __pyx_k_thetaS, sizeof(__pyx_k_thetaS), 0, 0, 1, 1},
22885  {&__pyx_n_s_thetaSR, __pyx_k_thetaSR, sizeof(__pyx_k_thetaSR), 0, 0, 1, 1},
22886  {&__pyx_n_s_thetaW, __pyx_k_thetaW, sizeof(__pyx_k_thetaW), 0, 0, 1, 1},
22887  {&__pyx_n_s_thisElementIsUpwind, __pyx_k_thisElementIsUpwind, sizeof(__pyx_k_thisElementIsUpwind), 0, 0, 1, 1},
22888  {&__pyx_n_s_transient, __pyx_k_transient, sizeof(__pyx_k_transient), 0, 0, 1, 1},
22889  {&__pyx_n_s_u_dof, __pyx_k_u_dof, sizeof(__pyx_k_u_dof), 0, 0, 1, 1},
22890  {&__pyx_n_s_u_eN, __pyx_k_u_eN, sizeof(__pyx_k_u_eN), 0, 0, 1, 1},
22891  {&__pyx_n_s_u_j, __pyx_k_u_j, sizeof(__pyx_k_u_j), 0, 0, 1, 1},
22892  {&__pyx_n_s_u_l2g, __pyx_k_u_l2g, sizeof(__pyx_k_u_l2g), 0, 0, 1, 1},
22893  {&__pyx_n_s_u_neig, __pyx_k_u_neig, sizeof(__pyx_k_u_neig), 0, 0, 1, 1},
22894  {&__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_k_unknown_dtype_code_in_numpy_pxd, sizeof(__pyx_k_unknown_dtype_code_in_numpy_pxd), 0, 1, 0, 0},
22895  {&__pyx_n_s_updateMassJacobian_weakAvg, __pyx_k_updateMassJacobian_weakAvg, sizeof(__pyx_k_updateMassJacobian_weakAvg), 0, 0, 1, 1},
22896  {&__pyx_n_s_updateMass_weakAvg, __pyx_k_updateMass_weakAvg, sizeof(__pyx_k_updateMass_weakAvg), 0, 0, 1, 1},
22897  {&__pyx_n_s_upwindFlag, __pyx_k_upwindFlag, sizeof(__pyx_k_upwindFlag), 0, 0, 1, 1},
22898  {&__pyx_n_s_v, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 1, 1},
22899  {&__pyx_n_s_vBar, __pyx_k_vBar, sizeof(__pyx_k_vBar), 0, 0, 1, 1},
22900  {&__pyx_n_s_vBar2, __pyx_k_vBar2, sizeof(__pyx_k_vBar2), 0, 0, 1, 1},
22901  {&__pyx_n_s_vol, __pyx_k_vol, sizeof(__pyx_k_vol), 0, 0, 1, 1},
22902  {&__pyx_n_s_volFactor, __pyx_k_volFactor, sizeof(__pyx_k_volFactor), 0, 0, 1, 1},
22903  {&__pyx_n_s_vol_e, __pyx_k_vol_e, sizeof(__pyx_k_vol_e), 0, 0, 1, 1},
22904  {&__pyx_n_s_volume, __pyx_k_volume, sizeof(__pyx_k_volume), 0, 0, 1, 1},
22905  {&__pyx_n_s_vortexElementVelocityEval3, __pyx_k_vortexElementVelocityEval3, sizeof(__pyx_k_vortexElementVelocityEval3), 0, 0, 1, 1},
22906  {&__pyx_n_s_vortexElementVelocityEval4, __pyx_k_vortexElementVelocityEval4, sizeof(__pyx_k_vortexElementVelocityEval4), 0, 0, 1, 1},
22907  {&__pyx_n_s_w, __pyx_k_w, sizeof(__pyx_k_w), 0, 0, 1, 1},
22908  {&__pyx_n_s_weak_residual, __pyx_k_weak_residual, sizeof(__pyx_k_weak_residual), 0, 0, 1, 1},
22909  {&__pyx_n_s_weight, __pyx_k_weight, sizeof(__pyx_k_weight), 0, 0, 1, 1},
22910  {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1},
22911  {&__pyx_n_s_xc, __pyx_k_xc, sizeof(__pyx_k_xc), 0, 0, 1, 1},
22912  {&__pyx_n_s_yc, __pyx_k_yc, sizeof(__pyx_k_yc), 0, 0, 1, 1},
22913  {&__pyx_n_s_zVelocity, __pyx_k_zVelocity, sizeof(__pyx_k_zVelocity), 0, 0, 1, 1},
22914  {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1},
22915  {&__pyx_n_s_zvelocity, __pyx_k_zvelocity, sizeof(__pyx_k_zvelocity), 0, 0, 1, 1},
22916  {0, 0, 0, 0, 0, 0, 0}
22917 };
22918 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
22919  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 24, __pyx_L1_error)
22920  __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(1, 777, __pyx_L1_error)
22921  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 781, __pyx_L1_error)
22922  __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 959, __pyx_L1_error)
22923  return 0;
22924  __pyx_L1_error:;
22925  return -1;
22926 }
22927 
22928 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
22929  __Pyx_RefNannyDeclarations
22930  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
22931 
22932  /* "subsurfaceTransportFunctions.pyx":66
22933  * material = elementMaterialTypes[eN]
22934  * for k in range(q_vals.shape[1]):
22935  * q_vals[eN,k,:] = material_functions[material].flat # <<<<<<<<<<<<<<
22936  *
22937  *
22938  */
22939  __pyx_slice_ = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice_)) __PYX_ERR(0, 66, __pyx_L1_error)
22940  __Pyx_GOTREF(__pyx_slice_);
22941  __Pyx_GIVEREF(__pyx_slice_);
22942 
22943  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":777
22944  *
22945  * if (end - f) - <int>(new_offset - offset[0]) < 15:
22946  * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<<
22947  *
22948  * if ((child.byteorder == c'>' and little_endian) or
22949  */
22950  __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 777, __pyx_L1_error)
22951  __Pyx_GOTREF(__pyx_tuple__2);
22952  __Pyx_GIVEREF(__pyx_tuple__2);
22953 
22954  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":781
22955  * if ((child.byteorder == c'>' and little_endian) or
22956  * (child.byteorder == c'<' and not little_endian)):
22957  * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
22958  * # One could encode it in the format string and have Cython
22959  * # complain instead, BUT: < and > in format strings also imply
22960  */
22961  __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 781, __pyx_L1_error)
22962  __Pyx_GOTREF(__pyx_tuple__3);
22963  __Pyx_GIVEREF(__pyx_tuple__3);
22964 
22965  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":801
22966  * t = child.type_num
22967  * if end - f < 5:
22968  * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<<
22969  *
22970  * # Until ticket #99 is fixed, use integers to avoid warnings
22971  */
22972  __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 801, __pyx_L1_error)
22973  __Pyx_GOTREF(__pyx_tuple__4);
22974  __Pyx_GIVEREF(__pyx_tuple__4);
22975 
22976  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":959
22977  * __pyx_import_array()
22978  * except Exception:
22979  * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<<
22980  *
22981  * cdef inline int import_umath() except -1:
22982  */
22983  __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 959, __pyx_L1_error)
22984  __Pyx_GOTREF(__pyx_tuple__5);
22985  __Pyx_GIVEREF(__pyx_tuple__5);
22986 
22987  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":965
22988  * _import_umath()
22989  * except Exception:
22990  * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
22991  *
22992  * cdef inline int import_ufunc() except -1:
22993  */
22994  __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(1, 965, __pyx_L1_error)
22995  __Pyx_GOTREF(__pyx_tuple__6);
22996  __Pyx_GIVEREF(__pyx_tuple__6);
22997 
22998  /* "subsurfaceTransportFunctions.pyx":18
22999  * ctypedef int ITYPE_t
23000  *
23001  * def setExteriorElementBoundaryTypes(int nExteriorElementBoundaries_global, # <<<<<<<<<<<<<<
23002  * numpy.ndarray[ITYPE_t,ndim=1] exteriorElementBoundariesArray,
23003  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
23004  */
23005  __pyx_tuple__7 = PyTuple_Pack(8, __pyx_n_s_nExteriorElementBoundaries_globa, __pyx_n_s_exteriorElementBoundariesArray, __pyx_n_s_elementBoundaryElementsArray, __pyx_n_s_elementMaterialTypes, __pyx_n_s_exteriorElementBoundaryMaterialT, __pyx_n_s_ebNE, __pyx_n_s_ebN, __pyx_n_s_eN); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 18, __pyx_L1_error)
23006  __Pyx_GOTREF(__pyx_tuple__7);
23007  __Pyx_GIVEREF(__pyx_tuple__7);
23008  __pyx_codeobj__8 = (PyObject*)__Pyx_PyCode_New(5, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__7, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_setExteriorElementBoundaryTypes, 18, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__8)) __PYX_ERR(0, 18, __pyx_L1_error)
23009 
23010  /* "subsurfaceTransportFunctions.pyx":29
23011  * exteriorElementBoundaryMaterialTypes[ebNE] = elementMaterialTypes[eN]
23012  *
23013  * def setElementBoundariesArray(int nElementBoundaries_global, # <<<<<<<<<<<<<<
23014  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
23015  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
23016  */
23017  __pyx_tuple__9 = PyTuple_Pack(7, __pyx_n_s_nElementBoundaries_global, __pyx_n_s_elementBoundaryElementsArray, __pyx_n_s_elementMaterialTypes, __pyx_n_s_elementBoundaryMaterialTypes, __pyx_n_s_ebN, __pyx_n_s_eN_left, __pyx_n_s_eN_right); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 29, __pyx_L1_error)
23018  __Pyx_GOTREF(__pyx_tuple__9);
23019  __Pyx_GIVEREF(__pyx_tuple__9);
23020  __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(4, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_setElementBoundariesArray, 29, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) __PYX_ERR(0, 29, __pyx_L1_error)
23021 
23022  /* "subsurfaceTransportFunctions.pyx":43
23023  *
23024  * ###
23025  * def setScalarMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
23026  * numpy.ndarray[DTYPE_t,ndim=2] q_vals,
23027  * dict material_functions):
23028  */
23029  __pyx_tuple__11 = PyTuple_Pack(6, __pyx_n_s_elementMaterialTypes, __pyx_n_s_q_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_material); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 43, __pyx_L1_error)
23030  __Pyx_GOTREF(__pyx_tuple__11);
23031  __Pyx_GIVEREF(__pyx_tuple__11);
23032  __pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_setScalarMaterialFunctionOverEle, 43, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__12)) __PYX_ERR(0, 43, __pyx_L1_error)
23033 
23034  /* "subsurfaceTransportFunctions.pyx":56
23035  * q_vals[eN,k] = material_functions[material]
23036  *
23037  * def setVectorMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
23038  * numpy.ndarray[DTYPE_t,ndim=3] q_vals,
23039  * dict material_functions):
23040  */
23041  __pyx_tuple__13 = PyTuple_Pack(6, __pyx_n_s_elementMaterialTypes, __pyx_n_s_q_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_material); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 56, __pyx_L1_error)
23042  __Pyx_GOTREF(__pyx_tuple__13);
23043  __Pyx_GIVEREF(__pyx_tuple__13);
23044  __pyx_codeobj__14 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__13, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_setVectorMaterialFunctionOverEle, 56, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__14)) __PYX_ERR(0, 56, __pyx_L1_error)
23045 
23046  /* "subsurfaceTransportFunctions.pyx":69
23047  *
23048  *
23049  * def setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
23050  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
23051  * numpy.ndarray[DTYPE_t,ndim=3] ebq_vals,
23052  */
23053  __pyx_tuple__15 = PyTuple_Pack(10, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_ebq_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_ebN, __pyx_n_s_ebN_local, __pyx_n_s_k, __pyx_n_s_material_left, __pyx_n_s_material_right); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 69, __pyx_L1_error)
23054  __Pyx_GOTREF(__pyx_tuple__15);
23055  __Pyx_GIVEREF(__pyx_tuple__15);
23056  __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(4, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_setScalarMaterialFunctionOverEle_2, 69, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(0, 69, __pyx_L1_error)
23057 
23058  /* "subsurfaceTransportFunctions.pyx":91
23059  * material_functions[material_right])
23060  *
23061  * def setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
23062  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
23063  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
23064  */
23065  __pyx_tuple__17 = PyTuple_Pack(15, __pyx_n_s_nd, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_ebq_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_ebN, __pyx_n_s_ebN_local, __pyx_n_s_k, __pyx_n_s_material_left, __pyx_n_s_material_right, __pyx_n_s_I, __pyx_n_s_J, __pyx_n_s_numer, __pyx_n_s_denom); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 91, __pyx_L1_error)
23066  __Pyx_GOTREF(__pyx_tuple__17);
23067  __Pyx_GIVEREF(__pyx_tuple__17);
23068  __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(5, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_setSparseTensorMaterialFunctionO, 91, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 91, __pyx_L1_error)
23069 
23070  /* "subsurfaceTransportFunctions.pyx":118
23071  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
23072  *
23073  * def setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
23074  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
23075  * numpy.ndarray[DTYPE_t,ndim=2] ebq_global_vals,
23076  */
23077  __pyx_tuple__19 = PyTuple_Pack(8, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_ebq_global_vals, __pyx_n_s_material_functions, __pyx_n_s_ebN, __pyx_n_s_material_left, __pyx_n_s_material_right, __pyx_n_s_k); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 118, __pyx_L1_error)
23078  __Pyx_GOTREF(__pyx_tuple__19);
23079  __Pyx_GIVEREF(__pyx_tuple__19);
23080  __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(4, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_setScalarMaterialFunctionOverGlo, 118, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 118, __pyx_L1_error)
23081 
23082  /* "subsurfaceTransportFunctions.pyx":139
23083  *
23084  *
23085  * def setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
23086  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
23087  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
23088  */
23089  __pyx_tuple__21 = PyTuple_Pack(13, __pyx_n_s_nd, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_ebq_global_vals, __pyx_n_s_material_functions, __pyx_n_s_ebN, __pyx_n_s_k, __pyx_n_s_material_left, __pyx_n_s_material_right, __pyx_n_s_I, __pyx_n_s_J, __pyx_n_s_numer, __pyx_n_s_denom); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 139, __pyx_L1_error)
23090  __Pyx_GOTREF(__pyx_tuple__21);
23091  __Pyx_GIVEREF(__pyx_tuple__21);
23092  __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(5, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_setSparseTensorMaterialFunctionO_2, 139, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 139, __pyx_L1_error)
23093 
23094  /* "subsurfaceTransportFunctions.pyx":165
23095  *
23096  * ###
23097  * def evaluateScalarMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
23098  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
23099  * numpy.ndarray[DTYPE_t,ndim=3] x,
23100  */
23101  __pyx_tuple__23 = PyTuple_Pack(8, __pyx_n_s_t, __pyx_n_s_elementMaterialTypes, __pyx_n_s_x, __pyx_n_s_q_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_material); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 165, __pyx_L1_error)
23102  __Pyx_GOTREF(__pyx_tuple__23);
23103  __Pyx_GIVEREF(__pyx_tuple__23);
23104  __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(5, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_evaluateScalarMaterialFunctionOv, 165, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 165, __pyx_L1_error)
23105 
23106  /* "subsurfaceTransportFunctions.pyx":180
23107  * q_vals[eN,k] = material_functions[material](x[eN,k],t)
23108  *
23109  * def evaluateVectorMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
23110  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
23111  * numpy.ndarray[DTYPE_t,ndim=3] x,
23112  */
23113  __pyx_tuple__25 = PyTuple_Pack(8, __pyx_n_s_t, __pyx_n_s_elementMaterialTypes, __pyx_n_s_x, __pyx_n_s_q_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_material); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 180, __pyx_L1_error)
23114  __Pyx_GOTREF(__pyx_tuple__25);
23115  __Pyx_GIVEREF(__pyx_tuple__25);
23116  __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(5, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_evaluateVectorMaterialFunctionOv, 180, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 180, __pyx_L1_error)
23117 
23118  /* "subsurfaceTransportFunctions.pyx":195
23119  *
23120  *
23121  * def evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
23122  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
23123  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
23124  */
23125  __pyx_tuple__27 = PyTuple_Pack(12, __pyx_n_s_t, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_x, __pyx_n_s_ebq_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_ebN, __pyx_n_s_ebN_local, __pyx_n_s_k, __pyx_n_s_material_left, __pyx_n_s_material_right); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 195, __pyx_L1_error)
23126  __Pyx_GOTREF(__pyx_tuple__27);
23127  __Pyx_GIVEREF(__pyx_tuple__27);
23128  __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(6, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_evaluateScalarMaterialFunctionOv_2, 195, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 195, __pyx_L1_error)
23129 
23130  /* "subsurfaceTransportFunctions.pyx":219
23131  * material_functions[material_right](x[eN,ebN_local,k],t))
23132  *
23133  * def evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
23134  * double t,
23135  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
23136  */
23137  __pyx_tuple__29 = PyTuple_Pack(17, __pyx_n_s_nd, __pyx_n_s_t, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_x, __pyx_n_s_ebq_vals, __pyx_n_s_material_functions, __pyx_n_s_eN, __pyx_n_s_ebN, __pyx_n_s_ebN_local, __pyx_n_s_k, __pyx_n_s_material_left, __pyx_n_s_material_right, __pyx_n_s_I, __pyx_n_s_J, __pyx_n_s_numer, __pyx_n_s_denom); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 219, __pyx_L1_error)
23138  __Pyx_GOTREF(__pyx_tuple__29);
23139  __Pyx_GIVEREF(__pyx_tuple__29);
23140  __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(7, 0, 17, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_evaluateSparseTensorMaterialFunc, 219, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 219, __pyx_L1_error)
23141 
23142  /* "subsurfaceTransportFunctions.pyx":248
23143  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
23144  *
23145  * def evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
23146  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
23147  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
23148  */
23149  __pyx_tuple__31 = PyTuple_Pack(10, __pyx_n_s_t, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_x, __pyx_n_s_ebq_global_vals, __pyx_n_s_material_functions, __pyx_n_s_ebN, __pyx_n_s_material_left, __pyx_n_s_material_right, __pyx_n_s_k); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 248, __pyx_L1_error)
23150  __Pyx_GOTREF(__pyx_tuple__31);
23151  __Pyx_GIVEREF(__pyx_tuple__31);
23152  __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(6, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_evaluateScalarMaterialFunctionOv_3, 248, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 248, __pyx_L1_error)
23153 
23154  /* "subsurfaceTransportFunctions.pyx":271
23155  *
23156  *
23157  * def evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
23158  * double t,
23159  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
23160  */
23161  __pyx_tuple__33 = PyTuple_Pack(15, __pyx_n_s_nd, __pyx_n_s_t, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryTypes, __pyx_n_s_x, __pyx_n_s_ebq_global_vals, __pyx_n_s_material_functions, __pyx_n_s_ebN, __pyx_n_s_k, __pyx_n_s_material_left, __pyx_n_s_material_right, __pyx_n_s_I, __pyx_n_s_J, __pyx_n_s_numer, __pyx_n_s_denom); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 271, __pyx_L1_error)
23162  __Pyx_GOTREF(__pyx_tuple__33);
23163  __Pyx_GIVEREF(__pyx_tuple__33);
23164  __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(7, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_evaluateSparseTensorMaterialFunc_2, 271, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 271, __pyx_L1_error)
23165 
23166  /* "subsurfaceTransportFunctions.pyx":301
23167  *
23168  * ##################################################
23169  * def RE_NCP1_evaluateElementCoefficients_Linear(double rho, # <<<<<<<<<<<<<<
23170  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
23171  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
23172  */
23173  __pyx_tuple__35 = PyTuple_Pack(24, __pyx_n_s_rho, __pyx_n_s_gravity, __pyx_n_s_rowptr, __pyx_n_s_colind, __pyx_n_s_KWs, __pyx_n_s_nSpace, __pyx_n_s_nElements_global, __pyx_n_s_nElementBoundaries_element, __pyx_n_s_elementNeighborsArray, __pyx_n_s_elementMaterialTypes, __pyx_n_s_q_flin, __pyx_n_s_q_alin, __pyx_n_s_eN, __pyx_n_s_eN_neighbor, __pyx_n_s_ii, __pyx_n_s_I, __pyx_n_s_ebN, __pyx_n_s_matID, __pyx_n_s_matID_neig, __pyx_n_s_nSpace2, __pyx_n_s_nnz, __pyx_n_s_a_eN, __pyx_n_s_a_neig, __pyx_n_s_a_avg); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 301, __pyx_L1_error)
23174  __Pyx_GOTREF(__pyx_tuple__35);
23175  __Pyx_GIVEREF(__pyx_tuple__35);
23176  __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(12, 0, 24, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_RE_NCP1_evaluateElementCoefficie, 301, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 301, __pyx_L1_error)
23177 
23178  /* "subsurfaceTransportFunctions.pyx":359
23179  *
23180  *
23181  * def RE_NCP1_evaluateElementCoefficients_VGM(double rho, # <<<<<<<<<<<<<<
23182  * double beta,
23183  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
23184  */
23185  __pyx_tuple__37 = PyTuple_Pack(61, __pyx_n_s_rho, __pyx_n_s_beta, __pyx_n_s_gravity, __pyx_n_s_alpha, __pyx_n_s_n, __pyx_n_s_thetaR, __pyx_n_s_thetaSR, __pyx_n_s_nSpace, __pyx_n_s_nElements_global, __pyx_n_s_nElementBoundaries_element, __pyx_n_s_elementNeighborsArray, __pyx_n_s_elementBarycentersArray, __pyx_n_s_elementMaterialTypes, __pyx_n_s_nDOF_trial_element, __pyx_n_s_u_l2g, __pyx_n_s_u_dof, __pyx_n_s_q_x, __pyx_n_s_q_u, __pyx_n_s_q_mass, __pyx_n_s_q_dmass, __pyx_n_s_q_r, __pyx_n_s_q_kr, __pyx_n_s_q_dkr, __pyx_n_s_q_kr_up, __pyx_n_s_q, __pyx_n_s_psiC, __pyx_n_s_pcBar, __pyx_n_s_pcBar_n, __pyx_n_s_pcBar_nM1, __pyx_n_s_pcBar_nM2, __pyx_n_s_onePlus_pcBar_n, __pyx_n_s_sBar, __pyx_n_s_sqrt_sBar, __pyx_n_s_DsBar_DpsiC, __pyx_n_s_thetaW, __pyx_n_s_DthetaW_DpsiC, __pyx_n_s_vBar, __pyx_n_s_vBar2, __pyx_n_s_DvBar_DpsiC, __pyx_n_s_KWr, __pyx_n_s_DKWr_DpsiC, __pyx_n_s_rho2, __pyx_n_s_thetaS, __pyx_n_s_rhom, __pyx_n_s_drhom, __pyx_n_s_m, __pyx_n_s_u_j, __pyx_n_s_u_eN, __pyx_n_s_u_neig, __pyx_n_s_kr_eN, __pyx_n_s_kr_neig, __pyx_n_s_phi_eN, __pyx_n_s_phi_neig, __pyx_n_s_eN, __pyx_n_s_eN_neighbor, __pyx_n_s_ebN, __pyx_n_s_ii, __pyx_n_s_I, __pyx_n_s_j, __pyx_n_s_matID, __pyx_n_s_nAvgWeight); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 359, __pyx_L1_error)
23186  __Pyx_GOTREF(__pyx_tuple__37);
23187  __Pyx_GIVEREF(__pyx_tuple__37);
23188  __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(24, 0, 61, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_RE_NCP1_evaluateElementCoefficie_2, 359, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 359, __pyx_L1_error)
23189 
23190  /* "subsurfaceTransportFunctions.pyx":486
23191  * #eN for upwind
23192  *
23193  * def RE_NCP1_getElementResidual(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
23194  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
23195  * numpy.ndarray[ITYPE_t,ndim=1] colind,
23196  */
23197  __pyx_tuple__39 = PyTuple_Pack(42, __pyx_n_s_gravity, __pyx_n_s_rowptr, __pyx_n_s_colind, __pyx_n_s_nSpace, __pyx_n_s_nElements_global, __pyx_n_s_nElementBoundaries_element, __pyx_n_s_elementNeighborsArray, __pyx_n_s_elementBarycentersArray, __pyx_n_s_nDOF_test_element, __pyx_n_s_q_u, __pyx_n_s_q_grad_u, __pyx_n_s_q_grad_w, __pyx_n_s_q_detJ, __pyx_n_s_q_m, __pyx_n_s_q_mt, __pyx_n_s_q_r, __pyx_n_s_q_kr, __pyx_n_s_q_kr_up, __pyx_n_s_q_flin, __pyx_n_s_q_alin, __pyx_n_s_elementResidual, __pyx_n_s_upwindFlag, __pyx_n_s_q, __pyx_n_s_nnz, __pyx_n_s_u_eN, __pyx_n_s_kr_eN, __pyx_n_s_phi_eN, __pyx_n_s_u_neig, __pyx_n_s_kr_neig, __pyx_n_s_phi_neig, __pyx_n_s_eN, __pyx_n_s_eN_neighbor, __pyx_n_s_ii, __pyx_n_s_I, __pyx_n_s_i, __pyx_n_s_ebN, __pyx_n_s_a_up, __pyx_n_s_f_up, __pyx_n_s_nAvgWeight, __pyx_n_s_weight, __pyx_n_s_volFactor, __pyx_n_s_volume); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 486, __pyx_L1_error)
23198  __Pyx_GOTREF(__pyx_tuple__39);
23199  __Pyx_GIVEREF(__pyx_tuple__39);
23200  __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(21, 0, 42, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_RE_NCP1_getElementResidual, 486, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 486, __pyx_L1_error)
23201 
23202  /* "subsurfaceTransportFunctions.pyx":574
23203  * #i
23204  * #eN
23205  * def RE_NCP1_getElementJacobian(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
23206  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
23207  * numpy.ndarray[ITYPE_t,ndim=1] colind,
23208  */
23209  __pyx_tuple__41 = PyTuple_Pack(51, __pyx_n_s_gravity, __pyx_n_s_rowptr, __pyx_n_s_colind, __pyx_n_s_nSpace, __pyx_n_s_nElements_global, __pyx_n_s_nElementBoundaries_element, __pyx_n_s_elementNeighborsArray, __pyx_n_s_elementBarycentersArray, __pyx_n_s_nDOF_test_element, __pyx_n_s_nDOF_trial_element, __pyx_n_s_q_u, __pyx_n_s_q_grad_u, __pyx_n_s_q_grad_w, __pyx_n_s_q_grad_v, __pyx_n_s_q_detJ, __pyx_n_s_q_m, __pyx_n_s_q_dm, __pyx_n_s_q_mt, __pyx_n_s_q_dmt, __pyx_n_s_q_r, __pyx_n_s_q_kr, __pyx_n_s_q_dkr, __pyx_n_s_q_kr_up, __pyx_n_s_q_flin, __pyx_n_s_q_alin, __pyx_n_s_elementJacobian, __pyx_n_s_upwindFlag, __pyx_n_s_picard, __pyx_n_s_q, __pyx_n_s_nnz, __pyx_n_s_u_eN, __pyx_n_s_kr_eN, __pyx_n_s_phi_eN, __pyx_n_s_u_neig, __pyx_n_s_kr_neig, __pyx_n_s_phi_neig, __pyx_n_s_dkr_up, __pyx_n_s_eN, __pyx_n_s_eN_neighbor, __pyx_n_s_ii, __pyx_n_s_I, __pyx_n_s_a_up, __pyx_n_s_f_up, __pyx_n_s_nAvgWeight, __pyx_n_s_weight, __pyx_n_s_volFactor, __pyx_n_s_thisElementIsUpwind, __pyx_n_s_volume, __pyx_n_s_i, __pyx_n_s_ebN, __pyx_n_s_j); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 574, __pyx_L1_error)
23210  __Pyx_GOTREF(__pyx_tuple__41);
23211  __Pyx_GIVEREF(__pyx_tuple__41);
23212  __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(26, 0, 51, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_RE_NCP1_getElementJacobian, 574, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) __PYX_ERR(0, 574, __pyx_L1_error)
23213 
23214  /* "subsurfaceTransportFunctions.pyx":673
23215  * ##################################################
23216  *
23217  * def updateMass_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] mt, # <<<<<<<<<<<<<<
23218  * numpy.ndarray[DTYPE_t,ndim=3] w,
23219  * numpy.ndarray[DTYPE_t,ndim=2] dV,
23220  */
23221  __pyx_tuple__43 = PyTuple_Pack(9, __pyx_n_s_mt, __pyx_n_s_w, __pyx_n_s_dV, __pyx_n_s_weak_residual, __pyx_n_s_eN, __pyx_n_s_i, __pyx_n_s_k, __pyx_n_s_mt_avg, __pyx_n_s_vol); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(0, 673, __pyx_L1_error)
23222  __Pyx_GOTREF(__pyx_tuple__43);
23223  __Pyx_GIVEREF(__pyx_tuple__43);
23224  __pyx_codeobj__44 = (PyObject*)__Pyx_PyCode_New(4, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__43, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_updateMass_weakAvg, 673, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__44)) __PYX_ERR(0, 673, __pyx_L1_error)
23225 
23226  /* "subsurfaceTransportFunctions.pyx":692
23227  * #cek hack, seems like cython needed some help figuring out that the rvalue was a float
23228  * weak_residual[eN,i] += float(mt_avg*w[eN,k,i]*dV[eN,k])
23229  * def updateMassJacobian_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] dmt, # <<<<<<<<<<<<<<
23230  * numpy.ndarray[DTYPE_t,ndim=3] w,
23231  * numpy.ndarray[DTYPE_t,ndim=3] v,
23232  */
23233  __pyx_tuple__45 = PyTuple_Pack(11, __pyx_n_s_dmt, __pyx_n_s_w, __pyx_n_s_v, __pyx_n_s_dV, __pyx_n_s_jacobian_weak_residual, __pyx_n_s_eN, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_k, __pyx_n_s_dmtj_avg, __pyx_n_s_vol); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 692, __pyx_L1_error)
23234  __Pyx_GOTREF(__pyx_tuple__45);
23235  __Pyx_GIVEREF(__pyx_tuple__45);
23236  __pyx_codeobj__46 = (PyObject*)__Pyx_PyCode_New(5, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__45, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_updateMassJacobian_weakAvg, 692, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__46)) __PYX_ERR(0, 692, __pyx_L1_error)
23237 
23238  /* "subsurfaceTransportFunctions.pyx":717
23239  * #ELLAM
23240  * ########################################################################
23241  * def calculateNormalFlux(numpy.ndarray[DTYPE_t,ndim=4] v, # <<<<<<<<<<<<<<
23242  * numpy.ndarray[DTYPE_t,ndim=4] n,
23243  * numpy.ndarray[DTYPE_t,ndim=3] dS,
23244  */
23245  __pyx_tuple__47 = PyTuple_Pack(9, __pyx_n_s_v, __pyx_n_s_n, __pyx_n_s_dS, __pyx_n_s_flux, __pyx_n_s_eN, __pyx_n_s_ebN, __pyx_n_s_kb, __pyx_n_s_integral, __pyx_n_s_I); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(0, 717, __pyx_L1_error)
23246  __Pyx_GOTREF(__pyx_tuple__47);
23247  __Pyx_GIVEREF(__pyx_tuple__47);
23248  __pyx_codeobj__48 = (PyObject*)__Pyx_PyCode_New(4, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__47, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_calculateNormalFlux, 717, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__48)) __PYX_ERR(0, 717, __pyx_L1_error)
23249 
23250  /* "subsurfaceTransportFunctions.pyx":732
23251  * flux[eN,ebN] = integral
23252  *
23253  * def computeSimpleCharacteristicVelocityFromElementVelocity(numpy.ndarray[DTYPE_t,ndim=3] df, # <<<<<<<<<<<<<<
23254  * numpy.ndarray[DTYPE_t,ndim=3] characteristic_velocity,
23255  * numpy.ndarray[DTYPE_t,ndim=2] dm,
23256  */
23257  __pyx_tuple__49 = PyTuple_Pack(9, __pyx_n_s_df, __pyx_n_s_characteristic_velocity, __pyx_n_s_dm, __pyx_n_s_dV, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_I, __pyx_n_s_omega_e, __pyx_n_s_vol_e); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(0, 732, __pyx_L1_error)
23258  __Pyx_GOTREF(__pyx_tuple__49);
23259  __Pyx_GIVEREF(__pyx_tuple__49);
23260  __pyx_codeobj__50 = (PyObject*)__Pyx_PyCode_New(4, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__49, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_computeSimpleCharacteristicVeloc, 732, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__50)) __PYX_ERR(0, 732, __pyx_L1_error)
23261 
23262  /* "subsurfaceTransportFunctions.pyx":753
23263  * characteristic_velocity[eN,k,I] = df[eN,k,I]*vol_e/(omega_e+1.0e-12)
23264  *
23265  * def computeSimpleCharacteristicVelocityFromVelocityDOFs(numpy.ndarray[DTYPE_t,ndim=1] df_dofs, # <<<<<<<<<<<<<<
23266  * numpy.ndarray[DTYPE_t,ndim=1] characteristic_velocity_dofs,
23267  * numpy.ndarray[ITYPE_t,ndim=2] l2g,
23268  */
23269  __pyx_tuple__51 = PyTuple_Pack(11, __pyx_n_s_df_dofs, __pyx_n_s_characteristic_velocity_dofs, __pyx_n_s_l2g, __pyx_n_s_dm, __pyx_n_s_dV, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_j, __pyx_n_s_J, __pyx_n_s_omega_e, __pyx_n_s_vol_e); if (unlikely(!__pyx_tuple__51)) __PYX_ERR(0, 753, __pyx_L1_error)
23270  __Pyx_GOTREF(__pyx_tuple__51);
23271  __Pyx_GIVEREF(__pyx_tuple__51);
23272  __pyx_codeobj__52 = (PyObject*)__Pyx_PyCode_New(5, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__51, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_computeSimpleCharacteristicVeloc_2, 753, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__52)) __PYX_ERR(0, 753, __pyx_L1_error)
23273 
23274  /* "subsurfaceTransportFunctions.pyx":776
23275  *
23276  * #problem specific velocity evaluation
23277  * def rotatingGaussianElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
23278  * double t,
23279  * double tForReversal,
23280  */
23281  __pyx_tuple__53 = PyTuple_Pack(12, __pyx_n_s_transient, __pyx_n_s_t, __pyx_n_s_tForReversal, __pyx_n_s_clock, __pyx_n_s_xc, __pyx_n_s_yc, __pyx_n_s_x, __pyx_n_s_v, __pyx_n_s_zvelocity, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_pi); if (unlikely(!__pyx_tuple__53)) __PYX_ERR(0, 776, __pyx_L1_error)
23282  __Pyx_GOTREF(__pyx_tuple__53);
23283  __Pyx_GIVEREF(__pyx_tuple__53);
23284  __pyx_codeobj__54 = (PyObject*)__Pyx_PyCode_New(9, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__53, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_rotatingGaussianElementVelocityE, 776, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__54)) __PYX_ERR(0, 776, __pyx_L1_error)
23285 
23286  /* "subsurfaceTransportFunctions.pyx":816
23287  *
23288  *
23289  * def rotatingGaussianElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
23290  * double t,
23291  * double tForReversal,
23292  */
23293  __pyx_tuple__55 = PyTuple_Pack(13, __pyx_n_s_transient, __pyx_n_s_t, __pyx_n_s_tForReversal, __pyx_n_s_clock, __pyx_n_s_xc, __pyx_n_s_yc, __pyx_n_s_x, __pyx_n_s_v, __pyx_n_s_zvelocity, __pyx_n_s_eN, __pyx_n_s_ebN, __pyx_n_s_k, __pyx_n_s_pi); if (unlikely(!__pyx_tuple__55)) __PYX_ERR(0, 816, __pyx_L1_error)
23294  __Pyx_GOTREF(__pyx_tuple__55);
23295  __Pyx_GIVEREF(__pyx_tuple__55);
23296  __pyx_codeobj__56 = (PyObject*)__Pyx_PyCode_New(9, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__55, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_rotatingGaussianElementVelocityE_2, 816, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__56)) __PYX_ERR(0, 816, __pyx_L1_error)
23297 
23298  /* "subsurfaceTransportFunctions.pyx":859
23299  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
23300  *
23301  * def helicalElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
23302  * double t,
23303  * double tForReversal,
23304  */
23305  __pyx_tuple__57 = PyTuple_Pack(12, __pyx_n_s_transient, __pyx_n_s_t, __pyx_n_s_tForReversal, __pyx_n_s_clock, __pyx_n_s_zVelocity, __pyx_n_s_xc, __pyx_n_s_yc, __pyx_n_s_x, __pyx_n_s_v, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_pi); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(0, 859, __pyx_L1_error)
23306  __Pyx_GOTREF(__pyx_tuple__57);
23307  __Pyx_GIVEREF(__pyx_tuple__57);
23308  __pyx_codeobj__58 = (PyObject*)__Pyx_PyCode_New(9, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__57, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_helicalElementVelocityEval3, 859, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__58)) __PYX_ERR(0, 859, __pyx_L1_error)
23309 
23310  /* "subsurfaceTransportFunctions.pyx":884
23311  * v[eN,k,2]=zVelocity
23312  *
23313  * def helicalElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
23314  * double t,
23315  * double tForReversal,
23316  */
23317  __pyx_tuple__59 = PyTuple_Pack(13, __pyx_n_s_transient, __pyx_n_s_t, __pyx_n_s_tForReversal, __pyx_n_s_clock, __pyx_n_s_zVelocity, __pyx_n_s_xc, __pyx_n_s_yc, __pyx_n_s_x, __pyx_n_s_v, __pyx_n_s_eN, __pyx_n_s_ebN, __pyx_n_s_k, __pyx_n_s_pi); if (unlikely(!__pyx_tuple__59)) __PYX_ERR(0, 884, __pyx_L1_error)
23318  __Pyx_GOTREF(__pyx_tuple__59);
23319  __Pyx_GIVEREF(__pyx_tuple__59);
23320  __pyx_codeobj__60 = (PyObject*)__Pyx_PyCode_New(9, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__59, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_helicalElementVelocityEval4, 884, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__60)) __PYX_ERR(0, 884, __pyx_L1_error)
23321 
23322  /* "subsurfaceTransportFunctions.pyx":911
23323  * v[eN,ebN,k,2]=zVelocity
23324  *
23325  * def vortexElementVelocityEval3(double t, # <<<<<<<<<<<<<<
23326  * numpy.ndarray[DTYPE_t,ndim=3] x,
23327  * numpy.ndarray[DTYPE_t,ndim=3] v):
23328  */
23329  __pyx_tuple__61 = PyTuple_Pack(7, __pyx_n_s_t, __pyx_n_s_x, __pyx_n_s_v, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_pi, __pyx_n_s_one8); if (unlikely(!__pyx_tuple__61)) __PYX_ERR(0, 911, __pyx_L1_error)
23330  __Pyx_GOTREF(__pyx_tuple__61);
23331  __Pyx_GIVEREF(__pyx_tuple__61);
23332  __pyx_codeobj__62 = (PyObject*)__Pyx_PyCode_New(3, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__61, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_vortexElementVelocityEval3, 911, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__62)) __PYX_ERR(0, 911, __pyx_L1_error)
23333 
23334  /* "subsurfaceTransportFunctions.pyx":924
23335  *
23336  *
23337  * def vortexElementVelocityEval4(double t, # <<<<<<<<<<<<<<
23338  * numpy.ndarray[DTYPE_t,ndim=4] x,
23339  * numpy.ndarray[DTYPE_t,ndim=4] v):
23340  */
23341  __pyx_tuple__63 = PyTuple_Pack(8, __pyx_n_s_t, __pyx_n_s_x, __pyx_n_s_v, __pyx_n_s_eN, __pyx_n_s_k, __pyx_n_s_ebN, __pyx_n_s_pi, __pyx_n_s_one8); if (unlikely(!__pyx_tuple__63)) __PYX_ERR(0, 924, __pyx_L1_error)
23342  __Pyx_GOTREF(__pyx_tuple__63);
23343  __Pyx_GIVEREF(__pyx_tuple__63);
23344  __pyx_codeobj__64 = (PyObject*)__Pyx_PyCode_New(3, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__63, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_subsurfaceTransportFunct, __pyx_n_s_vortexElementVelocityEval4, 924, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__64)) __PYX_ERR(0, 924, __pyx_L1_error)
23345  __Pyx_RefNannyFinishContext();
23346  return 0;
23347  __pyx_L1_error:;
23348  __Pyx_RefNannyFinishContext();
23349  return -1;
23350 }
23351 
23352 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
23353  if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
23354  __pyx_float_0_0 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_float_0_0)) __PYX_ERR(0, 1, __pyx_L1_error)
23355  __pyx_float_0_5 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_float_0_5)) __PYX_ERR(0, 1, __pyx_L1_error)
23356  __pyx_float_2_0 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_float_2_0)) __PYX_ERR(0, 1, __pyx_L1_error)
23357  __pyx_float_1_0eneg_20 = PyFloat_FromDouble(1.0e-20); if (unlikely(!__pyx_float_1_0eneg_20)) __PYX_ERR(0, 1, __pyx_L1_error)
23358  return 0;
23359  __pyx_L1_error:;
23360  return -1;
23361 }
23362 
23363 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
23364 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
23365 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
23366 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
23367 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
23368 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
23369 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
23370 
23371 static int __Pyx_modinit_global_init_code(void) {
23372  __Pyx_RefNannyDeclarations
23373  __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
23374  /*--- Global init code ---*/
23375  __Pyx_RefNannyFinishContext();
23376  return 0;
23377 }
23378 
23379 static int __Pyx_modinit_variable_export_code(void) {
23380  __Pyx_RefNannyDeclarations
23381  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
23382  /*--- Variable export code ---*/
23383  __Pyx_RefNannyFinishContext();
23384  return 0;
23385 }
23386 
23387 static int __Pyx_modinit_function_export_code(void) {
23388  __Pyx_RefNannyDeclarations
23389  __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
23390  /*--- Function export code ---*/
23391  __Pyx_RefNannyFinishContext();
23392  return 0;
23393 }
23394 
23395 static int __Pyx_modinit_type_init_code(void) {
23396  __Pyx_RefNannyDeclarations
23397  __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
23398  /*--- Type init code ---*/
23399  __Pyx_RefNannyFinishContext();
23400  return 0;
23401 }
23402 
23403 static int __Pyx_modinit_type_import_code(void) {
23404  __Pyx_RefNannyDeclarations
23405  PyObject *__pyx_t_1 = NULL;
23406  int __pyx_lineno = 0;
23407  const char *__pyx_filename = NULL;
23408  int __pyx_clineno = 0;
23409  __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
23410  /*--- Type import code ---*/
23411  __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 9, __pyx_L1_error)
23412  __Pyx_GOTREF(__pyx_t_1);
23413  __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
23414  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
23415  sizeof(PyTypeObject),
23416  #else
23417  sizeof(PyHeapTypeObject),
23418  #endif
23419  __Pyx_ImportType_CheckSize_Warn);
23420  if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(2, 9, __pyx_L1_error)
23421  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23422  __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 207, __pyx_L1_error)
23423  __Pyx_GOTREF(__pyx_t_1);
23424  __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore);
23425  if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(1, 207, __pyx_L1_error)
23426  __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Ignore);
23427  if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(1, 230, __pyx_L1_error)
23428  __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Ignore);
23429  if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(1, 234, __pyx_L1_error)
23430  __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore);
23431  if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(1, 246, __pyx_L1_error)
23432  __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Ignore);
23433  if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(1, 839, __pyx_L1_error)
23434  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23435  __Pyx_RefNannyFinishContext();
23436  return 0;
23437  __pyx_L1_error:;
23438  __Pyx_XDECREF(__pyx_t_1);
23439  __Pyx_RefNannyFinishContext();
23440  return -1;
23441 }
23442 
23443 static int __Pyx_modinit_variable_import_code(void) {
23444  __Pyx_RefNannyDeclarations
23445  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
23446  /*--- Variable import code ---*/
23447  __Pyx_RefNannyFinishContext();
23448  return 0;
23449 }
23450 
23451 static int __Pyx_modinit_function_import_code(void) {
23452  __Pyx_RefNannyDeclarations
23453  __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
23454  /*--- Function import code ---*/
23455  __Pyx_RefNannyFinishContext();
23456  return 0;
23457 }
23458 
23459 
23460 #ifndef CYTHON_NO_PYINIT_EXPORT
23461 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
23462 #elif PY_MAJOR_VERSION < 3
23463 #ifdef __cplusplus
23464 #define __Pyx_PyMODINIT_FUNC extern "C" void
23465 #else
23466 #define __Pyx_PyMODINIT_FUNC void
23467 #endif
23468 #else
23469 #ifdef __cplusplus
23470 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
23471 #else
23472 #define __Pyx_PyMODINIT_FUNC PyObject *
23473 #endif
23474 #endif
23475 
23476 
23477 #if PY_MAJOR_VERSION < 3
23478 __Pyx_PyMODINIT_FUNC initsubsurfaceTransportFunctions(void) CYTHON_SMALL_CODE; /*proto*/
23479 __Pyx_PyMODINIT_FUNC initsubsurfaceTransportFunctions(void)
23480 #else
23481 __Pyx_PyMODINIT_FUNC PyInit_subsurfaceTransportFunctions(void) CYTHON_SMALL_CODE; /*proto*/
23482 __Pyx_PyMODINIT_FUNC PyInit_subsurfaceTransportFunctions(void)
23483 #if CYTHON_PEP489_MULTI_PHASE_INIT
23484 {
23485  return PyModuleDef_Init(&__pyx_moduledef);
23486 }
23487 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
23488  #if PY_VERSION_HEX >= 0x030700A1
23489  static PY_INT64_T main_interpreter_id = -1;
23490  PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
23491  if (main_interpreter_id == -1) {
23492  main_interpreter_id = current_id;
23493  return (unlikely(current_id == -1)) ? -1 : 0;
23494  } else if (unlikely(main_interpreter_id != current_id))
23495  #else
23496  static PyInterpreterState *main_interpreter = NULL;
23497  PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
23498  if (!main_interpreter) {
23499  main_interpreter = current_interpreter;
23500  } else if (unlikely(main_interpreter != current_interpreter))
23501  #endif
23502  {
23503  PyErr_SetString(
23504  PyExc_ImportError,
23505  "Interpreter change detected - this module can only be loaded into one interpreter per process.");
23506  return -1;
23507  }
23508  return 0;
23509 }
23510 static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) {
23511  PyObject *value = PyObject_GetAttrString(spec, from_name);
23512  int result = 0;
23513  if (likely(value)) {
23514  if (allow_none || value != Py_None) {
23515  result = PyDict_SetItemString(moddict, to_name, value);
23516  }
23517  Py_DECREF(value);
23518  } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
23519  PyErr_Clear();
23520  } else {
23521  result = -1;
23522  }
23523  return result;
23524 }
23525 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
23526  PyObject *module = NULL, *moddict, *modname;
23527  if (__Pyx_check_single_interpreter())
23528  return NULL;
23529  if (__pyx_m)
23530  return __Pyx_NewRef(__pyx_m);
23531  modname = PyObject_GetAttrString(spec, "name");
23532  if (unlikely(!modname)) goto bad;
23533  module = PyModule_NewObject(modname);
23534  Py_DECREF(modname);
23535  if (unlikely(!module)) goto bad;
23536  moddict = PyModule_GetDict(module);
23537  if (unlikely(!moddict)) goto bad;
23538  if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
23539  if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
23540  if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
23541  if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
23542  return module;
23543 bad:
23544  Py_XDECREF(module);
23545  return NULL;
23546 }
23547 
23548 
23549 static CYTHON_SMALL_CODE int __pyx_pymod_exec_subsurfaceTransportFunctions(PyObject *__pyx_pyinit_module)
23550 #endif
23551 #endif
23552 {
23553  PyObject *__pyx_t_1 = NULL;
23554  int __pyx_lineno = 0;
23555  const char *__pyx_filename = NULL;
23556  int __pyx_clineno = 0;
23557  __Pyx_RefNannyDeclarations
23558  #if CYTHON_PEP489_MULTI_PHASE_INIT
23559  if (__pyx_m) {
23560  if (__pyx_m == __pyx_pyinit_module) return 0;
23561  PyErr_SetString(PyExc_RuntimeError, "Module 'subsurfaceTransportFunctions' has already been imported. Re-initialisation is not supported.");
23562  return -1;
23563  }
23564  #elif PY_MAJOR_VERSION >= 3
23565  if (__pyx_m) return __Pyx_NewRef(__pyx_m);
23566  #endif
23567  #if CYTHON_REFNANNY
23568 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
23569 if (!__Pyx_RefNanny) {
23570  PyErr_Clear();
23571  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
23572  if (!__Pyx_RefNanny)
23573  Py_FatalError("failed to import 'refnanny' module");
23574 }
23575 #endif
23576  __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_subsurfaceTransportFunctions(void)", 0);
23577  if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23578  #ifdef __Pxy_PyFrame_Initialize_Offsets
23579  __Pxy_PyFrame_Initialize_Offsets();
23580  #endif
23581  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
23582  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
23583  __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
23584  #ifdef __Pyx_CyFunction_USED
23585  if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23586  #endif
23587  #ifdef __Pyx_FusedFunction_USED
23588  if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23589  #endif
23590  #ifdef __Pyx_Coroutine_USED
23591  if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23592  #endif
23593  #ifdef __Pyx_Generator_USED
23594  if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23595  #endif
23596  #ifdef __Pyx_AsyncGen_USED
23597  if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23598  #endif
23599  #ifdef __Pyx_StopAsyncIteration_USED
23600  if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23601  #endif
23602  /*--- Library function declarations ---*/
23603  /*--- Threads initialization code ---*/
23604  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
23605  #ifdef WITH_THREAD /* Python build with threading support? */
23606  PyEval_InitThreads();
23607  #endif
23608  #endif
23609  /*--- Module creation code ---*/
23610  #if CYTHON_PEP489_MULTI_PHASE_INIT
23611  __pyx_m = __pyx_pyinit_module;
23612  Py_INCREF(__pyx_m);
23613  #else
23614  #if PY_MAJOR_VERSION < 3
23615  __pyx_m = Py_InitModule4("subsurfaceTransportFunctions", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
23616  #else
23617  __pyx_m = PyModule_Create(&__pyx_moduledef);
23618  #endif
23619  if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
23620  #endif
23621  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
23622  Py_INCREF(__pyx_d);
23623  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
23624  Py_INCREF(__pyx_b);
23625  __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
23626  Py_INCREF(__pyx_cython_runtime);
23627  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
23628  /*--- Initialize various global constants etc. ---*/
23629  if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23630  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
23631  if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23632  #endif
23633  if (__pyx_module_is_main_subsurfaceTransportFunctions) {
23634  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23635  }
23636  #if PY_MAJOR_VERSION >= 3
23637  {
23638  PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
23639  if (!PyDict_GetItemString(modules, "subsurfaceTransportFunctions")) {
23640  if (unlikely(PyDict_SetItemString(modules, "subsurfaceTransportFunctions", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
23641  }
23642  }
23643  #endif
23644  /*--- Builtin init code ---*/
23645  if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23646  /*--- Constants init code ---*/
23647  if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23648  /*--- Global type/function init code ---*/
23649  (void)__Pyx_modinit_global_init_code();
23650  (void)__Pyx_modinit_variable_export_code();
23651  (void)__Pyx_modinit_function_export_code();
23652  (void)__Pyx_modinit_type_init_code();
23653  if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
23654  (void)__Pyx_modinit_variable_import_code();
23655  (void)__Pyx_modinit_function_import_code();
23656  /*--- Execution code ---*/
23657  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
23658  if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23659  #endif
23660 
23661  /* "subsurfaceTransportFunctions.pyx":1
23662  * import numpy # <<<<<<<<<<<<<<
23663  * cimport numpy
23664  * cdef extern from "math.h":
23665  */
23666  __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
23667  __Pyx_GOTREF(__pyx_t_1);
23668  if (PyDict_SetItem(__pyx_d, __pyx_n_s_numpy, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23669  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23670 
23671  /* "subsurfaceTransportFunctions.pyx":18
23672  * ctypedef int ITYPE_t
23673  *
23674  * def setExteriorElementBoundaryTypes(int nExteriorElementBoundaries_global, # <<<<<<<<<<<<<<
23675  * numpy.ndarray[ITYPE_t,ndim=1] exteriorElementBoundariesArray,
23676  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
23677  */
23678  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_1setExteriorElementBoundaryTypes, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error)
23679  __Pyx_GOTREF(__pyx_t_1);
23680  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setExteriorElementBoundaryTypes, __pyx_t_1) < 0) __PYX_ERR(0, 18, __pyx_L1_error)
23681  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23682 
23683  /* "subsurfaceTransportFunctions.pyx":29
23684  * exteriorElementBoundaryMaterialTypes[ebNE] = elementMaterialTypes[eN]
23685  *
23686  * def setElementBoundariesArray(int nElementBoundaries_global, # <<<<<<<<<<<<<<
23687  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryElementsArray,
23688  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
23689  */
23690  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_3setElementBoundariesArray, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error)
23691  __Pyx_GOTREF(__pyx_t_1);
23692  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setElementBoundariesArray, __pyx_t_1) < 0) __PYX_ERR(0, 29, __pyx_L1_error)
23693  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23694 
23695  /* "subsurfaceTransportFunctions.pyx":43
23696  *
23697  * ###
23698  * def setScalarMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
23699  * numpy.ndarray[DTYPE_t,ndim=2] q_vals,
23700  * dict material_functions):
23701  */
23702  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_5setScalarMaterialFunctionOverElements, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 43, __pyx_L1_error)
23703  __Pyx_GOTREF(__pyx_t_1);
23704  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setScalarMaterialFunctionOverEle, __pyx_t_1) < 0) __PYX_ERR(0, 43, __pyx_L1_error)
23705  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23706 
23707  /* "subsurfaceTransportFunctions.pyx":56
23708  * q_vals[eN,k] = material_functions[material]
23709  *
23710  * def setVectorMaterialFunctionOverElements(numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes, # <<<<<<<<<<<<<<
23711  * numpy.ndarray[DTYPE_t,ndim=3] q_vals,
23712  * dict material_functions):
23713  */
23714  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_7setVectorMaterialFunctionOverElements, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error)
23715  __Pyx_GOTREF(__pyx_t_1);
23716  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setVectorMaterialFunctionOverEle, __pyx_t_1) < 0) __PYX_ERR(0, 56, __pyx_L1_error)
23717  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23718 
23719  /* "subsurfaceTransportFunctions.pyx":69
23720  *
23721  *
23722  * def setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
23723  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
23724  * numpy.ndarray[DTYPE_t,ndim=3] ebq_vals,
23725  */
23726  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_9setScalarMaterialFunctionOverElementBoundaries_arithmeticAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error)
23727  __Pyx_GOTREF(__pyx_t_1);
23728  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setScalarMaterialFunctionOverEle_2, __pyx_t_1) < 0) __PYX_ERR(0, 69, __pyx_L1_error)
23729  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23730 
23731  /* "subsurfaceTransportFunctions.pyx":91
23732  * material_functions[material_right])
23733  *
23734  * def setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
23735  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
23736  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
23737  */
23738  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_11setSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error)
23739  __Pyx_GOTREF(__pyx_t_1);
23740  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setSparseTensorMaterialFunctionO, __pyx_t_1) < 0) __PYX_ERR(0, 91, __pyx_L1_error)
23741  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23742 
23743  /* "subsurfaceTransportFunctions.pyx":118
23744  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
23745  *
23746  * def setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray, # <<<<<<<<<<<<<<
23747  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
23748  * numpy.ndarray[DTYPE_t,ndim=2] ebq_global_vals,
23749  */
23750  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_13setScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __pyx_L1_error)
23751  __Pyx_GOTREF(__pyx_t_1);
23752  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setScalarMaterialFunctionOverGlo, __pyx_t_1) < 0) __PYX_ERR(0, 118, __pyx_L1_error)
23753  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23754 
23755  /* "subsurfaceTransportFunctions.pyx":139
23756  *
23757  *
23758  * def setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
23759  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
23760  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
23761  */
23762  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_15setSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 139, __pyx_L1_error)
23763  __Pyx_GOTREF(__pyx_t_1);
23764  if (PyDict_SetItem(__pyx_d, __pyx_n_s_setSparseTensorMaterialFunctionO_2, __pyx_t_1) < 0) __PYX_ERR(0, 139, __pyx_L1_error)
23765  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23766 
23767  /* "subsurfaceTransportFunctions.pyx":165
23768  *
23769  * ###
23770  * def evaluateScalarMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
23771  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
23772  * numpy.ndarray[DTYPE_t,ndim=3] x,
23773  */
23774  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_17evaluateScalarMaterialFunctionOverElements, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 165, __pyx_L1_error)
23775  __Pyx_GOTREF(__pyx_t_1);
23776  if (PyDict_SetItem(__pyx_d, __pyx_n_s_evaluateScalarMaterialFunctionOv, __pyx_t_1) < 0) __PYX_ERR(0, 165, __pyx_L1_error)
23777  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23778 
23779  /* "subsurfaceTransportFunctions.pyx":180
23780  * q_vals[eN,k] = material_functions[material](x[eN,k],t)
23781  *
23782  * def evaluateVectorMaterialFunctionOverElements(double t, # <<<<<<<<<<<<<<
23783  * numpy.ndarray[ITYPE_t,ndim=1] elementMaterialTypes,
23784  * numpy.ndarray[DTYPE_t,ndim=3] x,
23785  */
23786  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_19evaluateVectorMaterialFunctionOverElements, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error)
23787  __Pyx_GOTREF(__pyx_t_1);
23788  if (PyDict_SetItem(__pyx_d, __pyx_n_s_evaluateVectorMaterialFunctionOv, __pyx_t_1) < 0) __PYX_ERR(0, 180, __pyx_L1_error)
23789  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23790 
23791  /* "subsurfaceTransportFunctions.pyx":195
23792  *
23793  *
23794  * def evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
23795  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
23796  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
23797  */
23798  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_21evaluateScalarMaterialFunctionOverElementBoundaries_arithmeticAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 195, __pyx_L1_error)
23799  __Pyx_GOTREF(__pyx_t_1);
23800  if (PyDict_SetItem(__pyx_d, __pyx_n_s_evaluateScalarMaterialFunctionOv_2, __pyx_t_1) < 0) __PYX_ERR(0, 195, __pyx_L1_error)
23801  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23802 
23803  /* "subsurfaceTransportFunctions.pyx":219
23804  * material_functions[material_right](x[eN,ebN_local,k],t))
23805  *
23806  * def evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
23807  * double t,
23808  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
23809  */
23810  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_23evaluateSparseTensorMaterialFunctionOverElementBoundaries_harmonicAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 219, __pyx_L1_error)
23811  __Pyx_GOTREF(__pyx_t_1);
23812  if (PyDict_SetItem(__pyx_d, __pyx_n_s_evaluateSparseTensorMaterialFunc, __pyx_t_1) < 0) __PYX_ERR(0, 219, __pyx_L1_error)
23813  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23814 
23815  /* "subsurfaceTransportFunctions.pyx":248
23816  * ebq_vals[eN,ebN_local,k,I*nd+J] = numer/denom
23817  *
23818  * def evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage(double t, # <<<<<<<<<<<<<<
23819  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
23820  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundaryTypes,
23821  */
23822  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_25evaluateScalarMaterialFunctionOverGlobalElementBoundaries_arithmeticAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 248, __pyx_L1_error)
23823  __Pyx_GOTREF(__pyx_t_1);
23824  if (PyDict_SetItem(__pyx_d, __pyx_n_s_evaluateScalarMaterialFunctionOv_3, __pyx_t_1) < 0) __PYX_ERR(0, 248, __pyx_L1_error)
23825  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23826 
23827  /* "subsurfaceTransportFunctions.pyx":271
23828  *
23829  *
23830  * def evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage(int nd, # <<<<<<<<<<<<<<
23831  * double t,
23832  * numpy.ndarray[ITYPE_t,ndim=2] elementBoundariesArray,
23833  */
23834  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_27evaluateSparseTensorMaterialFunctionOverGlobalElementBoundaries_harmonicAverage, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 271, __pyx_L1_error)
23835  __Pyx_GOTREF(__pyx_t_1);
23836  if (PyDict_SetItem(__pyx_d, __pyx_n_s_evaluateSparseTensorMaterialFunc_2, __pyx_t_1) < 0) __PYX_ERR(0, 271, __pyx_L1_error)
23837  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23838 
23839  /* "subsurfaceTransportFunctions.pyx":301
23840  *
23841  * ##################################################
23842  * def RE_NCP1_evaluateElementCoefficients_Linear(double rho, # <<<<<<<<<<<<<<
23843  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
23844  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
23845  */
23846  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_29RE_NCP1_evaluateElementCoefficients_Linear, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 301, __pyx_L1_error)
23847  __Pyx_GOTREF(__pyx_t_1);
23848  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RE_NCP1_evaluateElementCoefficie, __pyx_t_1) < 0) __PYX_ERR(0, 301, __pyx_L1_error)
23849  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23850 
23851  /* "subsurfaceTransportFunctions.pyx":359
23852  *
23853  *
23854  * def RE_NCP1_evaluateElementCoefficients_VGM(double rho, # <<<<<<<<<<<<<<
23855  * double beta,
23856  * numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities
23857  */
23858  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_31RE_NCP1_evaluateElementCoefficients_VGM, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 359, __pyx_L1_error)
23859  __Pyx_GOTREF(__pyx_t_1);
23860  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RE_NCP1_evaluateElementCoefficie_2, __pyx_t_1) < 0) __PYX_ERR(0, 359, __pyx_L1_error)
23861  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23862 
23863  /* "subsurfaceTransportFunctions.pyx":486
23864  * #eN for upwind
23865  *
23866  * def RE_NCP1_getElementResidual(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
23867  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
23868  * numpy.ndarray[ITYPE_t,ndim=1] colind,
23869  */
23870  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_33RE_NCP1_getElementResidual, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 486, __pyx_L1_error)
23871  __Pyx_GOTREF(__pyx_t_1);
23872  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RE_NCP1_getElementResidual, __pyx_t_1) < 0) __PYX_ERR(0, 486, __pyx_L1_error)
23873  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23874 
23875  /* "subsurfaceTransportFunctions.pyx":574
23876  * #i
23877  * #eN
23878  * def RE_NCP1_getElementJacobian(numpy.ndarray[DTYPE_t,ndim=1] gravity,#physical quantities # <<<<<<<<<<<<<<
23879  * numpy.ndarray[ITYPE_t,ndim=1] rowptr,
23880  * numpy.ndarray[ITYPE_t,ndim=1] colind,
23881  */
23882  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_35RE_NCP1_getElementJacobian, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 574, __pyx_L1_error)
23883  __Pyx_GOTREF(__pyx_t_1);
23884  if (PyDict_SetItem(__pyx_d, __pyx_n_s_RE_NCP1_getElementJacobian, __pyx_t_1) < 0) __PYX_ERR(0, 574, __pyx_L1_error)
23885  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23886 
23887  /* "subsurfaceTransportFunctions.pyx":673
23888  * ##################################################
23889  *
23890  * def updateMass_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] mt, # <<<<<<<<<<<<<<
23891  * numpy.ndarray[DTYPE_t,ndim=3] w,
23892  * numpy.ndarray[DTYPE_t,ndim=2] dV,
23893  */
23894  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_37updateMass_weakAvg, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 673, __pyx_L1_error)
23895  __Pyx_GOTREF(__pyx_t_1);
23896  if (PyDict_SetItem(__pyx_d, __pyx_n_s_updateMass_weakAvg, __pyx_t_1) < 0) __PYX_ERR(0, 673, __pyx_L1_error)
23897  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23898 
23899  /* "subsurfaceTransportFunctions.pyx":692
23900  * #cek hack, seems like cython needed some help figuring out that the rvalue was a float
23901  * weak_residual[eN,i] += float(mt_avg*w[eN,k,i]*dV[eN,k])
23902  * def updateMassJacobian_weakAvg(numpy.ndarray[DTYPE_t,ndim=2] dmt, # <<<<<<<<<<<<<<
23903  * numpy.ndarray[DTYPE_t,ndim=3] w,
23904  * numpy.ndarray[DTYPE_t,ndim=3] v,
23905  */
23906  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_39updateMassJacobian_weakAvg, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 692, __pyx_L1_error)
23907  __Pyx_GOTREF(__pyx_t_1);
23908  if (PyDict_SetItem(__pyx_d, __pyx_n_s_updateMassJacobian_weakAvg, __pyx_t_1) < 0) __PYX_ERR(0, 692, __pyx_L1_error)
23909  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23910 
23911  /* "subsurfaceTransportFunctions.pyx":717
23912  * #ELLAM
23913  * ########################################################################
23914  * def calculateNormalFlux(numpy.ndarray[DTYPE_t,ndim=4] v, # <<<<<<<<<<<<<<
23915  * numpy.ndarray[DTYPE_t,ndim=4] n,
23916  * numpy.ndarray[DTYPE_t,ndim=3] dS,
23917  */
23918  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_41calculateNormalFlux, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 717, __pyx_L1_error)
23919  __Pyx_GOTREF(__pyx_t_1);
23920  if (PyDict_SetItem(__pyx_d, __pyx_n_s_calculateNormalFlux, __pyx_t_1) < 0) __PYX_ERR(0, 717, __pyx_L1_error)
23921  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23922 
23923  /* "subsurfaceTransportFunctions.pyx":732
23924  * flux[eN,ebN] = integral
23925  *
23926  * def computeSimpleCharacteristicVelocityFromElementVelocity(numpy.ndarray[DTYPE_t,ndim=3] df, # <<<<<<<<<<<<<<
23927  * numpy.ndarray[DTYPE_t,ndim=3] characteristic_velocity,
23928  * numpy.ndarray[DTYPE_t,ndim=2] dm,
23929  */
23930  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_43computeSimpleCharacteristicVelocityFromElementVelocity, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 732, __pyx_L1_error)
23931  __Pyx_GOTREF(__pyx_t_1);
23932  if (PyDict_SetItem(__pyx_d, __pyx_n_s_computeSimpleCharacteristicVeloc, __pyx_t_1) < 0) __PYX_ERR(0, 732, __pyx_L1_error)
23933  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23934 
23935  /* "subsurfaceTransportFunctions.pyx":753
23936  * characteristic_velocity[eN,k,I] = df[eN,k,I]*vol_e/(omega_e+1.0e-12)
23937  *
23938  * def computeSimpleCharacteristicVelocityFromVelocityDOFs(numpy.ndarray[DTYPE_t,ndim=1] df_dofs, # <<<<<<<<<<<<<<
23939  * numpy.ndarray[DTYPE_t,ndim=1] characteristic_velocity_dofs,
23940  * numpy.ndarray[ITYPE_t,ndim=2] l2g,
23941  */
23942  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_45computeSimpleCharacteristicVelocityFromVelocityDOFs, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 753, __pyx_L1_error)
23943  __Pyx_GOTREF(__pyx_t_1);
23944  if (PyDict_SetItem(__pyx_d, __pyx_n_s_computeSimpleCharacteristicVeloc_2, __pyx_t_1) < 0) __PYX_ERR(0, 753, __pyx_L1_error)
23945  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23946 
23947  /* "subsurfaceTransportFunctions.pyx":776
23948  *
23949  * #problem specific velocity evaluation
23950  * def rotatingGaussianElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
23951  * double t,
23952  * double tForReversal,
23953  */
23954  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_47rotatingGaussianElementVelocityEval3, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 776, __pyx_L1_error)
23955  __Pyx_GOTREF(__pyx_t_1);
23956  if (PyDict_SetItem(__pyx_d, __pyx_n_s_rotatingGaussianElementVelocityE, __pyx_t_1) < 0) __PYX_ERR(0, 776, __pyx_L1_error)
23957  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23958 
23959  /* "subsurfaceTransportFunctions.pyx":816
23960  *
23961  *
23962  * def rotatingGaussianElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
23963  * double t,
23964  * double tForReversal,
23965  */
23966  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_49rotatingGaussianElementVelocityEval4, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 816, __pyx_L1_error)
23967  __Pyx_GOTREF(__pyx_t_1);
23968  if (PyDict_SetItem(__pyx_d, __pyx_n_s_rotatingGaussianElementVelocityE_2, __pyx_t_1) < 0) __PYX_ERR(0, 816, __pyx_L1_error)
23969  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23970 
23971  /* "subsurfaceTransportFunctions.pyx":859
23972  * v[eN,ebN,k,1]=2.0*pi*(yc-x[eN,ebN,k,0])
23973  *
23974  * def helicalElementVelocityEval3(int transient, # <<<<<<<<<<<<<<
23975  * double t,
23976  * double tForReversal,
23977  */
23978  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_51helicalElementVelocityEval3, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 859, __pyx_L1_error)
23979  __Pyx_GOTREF(__pyx_t_1);
23980  if (PyDict_SetItem(__pyx_d, __pyx_n_s_helicalElementVelocityEval3, __pyx_t_1) < 0) __PYX_ERR(0, 859, __pyx_L1_error)
23981  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23982 
23983  /* "subsurfaceTransportFunctions.pyx":884
23984  * v[eN,k,2]=zVelocity
23985  *
23986  * def helicalElementVelocityEval4(int transient, # <<<<<<<<<<<<<<
23987  * double t,
23988  * double tForReversal,
23989  */
23990  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_53helicalElementVelocityEval4, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 884, __pyx_L1_error)
23991  __Pyx_GOTREF(__pyx_t_1);
23992  if (PyDict_SetItem(__pyx_d, __pyx_n_s_helicalElementVelocityEval4, __pyx_t_1) < 0) __PYX_ERR(0, 884, __pyx_L1_error)
23993  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23994 
23995  /* "subsurfaceTransportFunctions.pyx":911
23996  * v[eN,ebN,k,2]=zVelocity
23997  *
23998  * def vortexElementVelocityEval3(double t, # <<<<<<<<<<<<<<
23999  * numpy.ndarray[DTYPE_t,ndim=3] x,
24000  * numpy.ndarray[DTYPE_t,ndim=3] v):
24001  */
24002  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_55vortexElementVelocityEval3, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 911, __pyx_L1_error)
24003  __Pyx_GOTREF(__pyx_t_1);
24004  if (PyDict_SetItem(__pyx_d, __pyx_n_s_vortexElementVelocityEval3, __pyx_t_1) < 0) __PYX_ERR(0, 911, __pyx_L1_error)
24005  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24006 
24007  /* "subsurfaceTransportFunctions.pyx":924
24008  *
24009  *
24010  * def vortexElementVelocityEval4(double t, # <<<<<<<<<<<<<<
24011  * numpy.ndarray[DTYPE_t,ndim=4] x,
24012  * numpy.ndarray[DTYPE_t,ndim=4] v):
24013  */
24014  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_28subsurfaceTransportFunctions_57vortexElementVelocityEval4, NULL, __pyx_n_s_subsurfaceTransportFunctions); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 924, __pyx_L1_error)
24015  __Pyx_GOTREF(__pyx_t_1);
24016  if (PyDict_SetItem(__pyx_d, __pyx_n_s_vortexElementVelocityEval4, __pyx_t_1) < 0) __PYX_ERR(0, 924, __pyx_L1_error)
24017  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24018 
24019  /* "subsurfaceTransportFunctions.pyx":1
24020  * import numpy # <<<<<<<<<<<<<<
24021  * cimport numpy
24022  * cdef extern from "math.h":
24023  */
24024  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
24025  __Pyx_GOTREF(__pyx_t_1);
24026  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
24027  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24028 
24029  /* "../miniconda3/envs/proteus-dev-up/lib/python3.8/site-packages/numpy/__init__.pxd":967
24030  * raise ImportError("numpy.core.umath failed to import")
24031  *
24032  * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
24033  * try:
24034  * _import_umath()
24035  */
24036 
24037  /*--- Wrapped vars code ---*/
24038 
24039  goto __pyx_L0;
24040  __pyx_L1_error:;
24041  __Pyx_XDECREF(__pyx_t_1);
24042  if (__pyx_m) {
24043  if (__pyx_d) {
24044  __Pyx_AddTraceback("init subsurfaceTransportFunctions", __pyx_clineno, __pyx_lineno, __pyx_filename);
24045  }
24046  Py_CLEAR(__pyx_m);
24047  } else if (!PyErr_Occurred()) {
24048  PyErr_SetString(PyExc_ImportError, "init subsurfaceTransportFunctions");
24049  }
24050  __pyx_L0:;
24051  __Pyx_RefNannyFinishContext();
24052  #if CYTHON_PEP489_MULTI_PHASE_INIT
24053  return (__pyx_m != NULL) ? 0 : -1;
24054  #elif PY_MAJOR_VERSION >= 3
24055  return __pyx_m;
24056  #else
24057  return;
24058  #endif
24059 }
24060 
24061 /* --- Runtime support code --- */
24062 /* Refnanny */
24063 #if CYTHON_REFNANNY
24064 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
24065  PyObject *m = NULL, *p = NULL;
24066  void *r = NULL;
24067  m = PyImport_ImportModule(modname);
24068  if (!m) goto end;
24069  p = PyObject_GetAttrString(m, "RefNannyAPI");
24070  if (!p) goto end;
24071  r = PyLong_AsVoidPtr(p);
24072 end:
24073  Py_XDECREF(p);
24074  Py_XDECREF(m);
24075  return (__Pyx_RefNannyAPIStruct *)r;
24076 }
24077 #endif
24078 
24079 /* PyObjectGetAttrStr */
24080 #if CYTHON_USE_TYPE_SLOTS
24081 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
24082  PyTypeObject* tp = Py_TYPE(obj);
24083  if (likely(tp->tp_getattro))
24084  return tp->tp_getattro(obj, attr_name);
24085 #if PY_MAJOR_VERSION < 3
24086  if (likely(tp->tp_getattr))
24087  return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
24088 #endif
24089  return PyObject_GetAttr(obj, attr_name);
24090 }
24091 #endif
24092 
24093 /* GetBuiltinName */
24094 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
24095  PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
24096  if (unlikely(!result)) {
24097  PyErr_Format(PyExc_NameError,
24098 #if PY_MAJOR_VERSION >= 3
24099  "name '%U' is not defined", name);
24100 #else
24101  "name '%.200s' is not defined", PyString_AS_STRING(name));
24102 #endif
24103  }
24104  return result;
24105 }
24106 
24107 /* RaiseArgTupleInvalid */
24108 static void __Pyx_RaiseArgtupleInvalid(
24109  const char* func_name,
24110  int exact,
24111  Py_ssize_t num_min,
24112  Py_ssize_t num_max,
24113  Py_ssize_t num_found)
24114 {
24115  Py_ssize_t num_expected;
24116  const char *more_or_less;
24117  if (num_found < num_min) {
24118  num_expected = num_min;
24119  more_or_less = "at least";
24120  } else {
24121  num_expected = num_max;
24122  more_or_less = "at most";
24123  }
24124  if (exact) {
24125  more_or_less = "exactly";
24126  }
24127  PyErr_Format(PyExc_TypeError,
24128  "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
24129  func_name, more_or_less, num_expected,
24130  (num_expected == 1) ? "" : "s", num_found);
24131 }
24132 
24133 /* RaiseDoubleKeywords */
24134 static void __Pyx_RaiseDoubleKeywordsError(
24135  const char* func_name,
24136  PyObject* kw_name)
24137 {
24138  PyErr_Format(PyExc_TypeError,
24139  #if PY_MAJOR_VERSION >= 3
24140  "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
24141  #else
24142  "%s() got multiple values for keyword argument '%s'", func_name,
24143  PyString_AsString(kw_name));
24144  #endif
24145 }
24146 
24147 /* ParseKeywords */
24148 static int __Pyx_ParseOptionalKeywords(
24149  PyObject *kwds,
24150  PyObject **argnames[],
24151  PyObject *kwds2,
24152  PyObject *values[],
24153  Py_ssize_t num_pos_args,
24154  const char* function_name)
24155 {
24156  PyObject *key = 0, *value = 0;
24157  Py_ssize_t pos = 0;
24158  PyObject*** name;
24159  PyObject*** first_kw_arg = argnames + num_pos_args;
24160  while (PyDict_Next(kwds, &pos, &key, &value)) {
24161  name = first_kw_arg;
24162  while (*name && (**name != key)) name++;
24163  if (*name) {
24164  values[name-argnames] = value;
24165  continue;
24166  }
24167  name = first_kw_arg;
24168  #if PY_MAJOR_VERSION < 3
24169  if (likely(PyString_Check(key))) {
24170  while (*name) {
24171  if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
24172  && _PyString_Eq(**name, key)) {
24173  values[name-argnames] = value;
24174  break;
24175  }
24176  name++;
24177  }
24178  if (*name) continue;
24179  else {
24180  PyObject*** argname = argnames;
24181  while (argname != first_kw_arg) {
24182  if ((**argname == key) || (
24183  (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
24184  && _PyString_Eq(**argname, key))) {
24185  goto arg_passed_twice;
24186  }
24187  argname++;
24188  }
24189  }
24190  } else
24191  #endif
24192  if (likely(PyUnicode_Check(key))) {
24193  while (*name) {
24194  int cmp = (**name == key) ? 0 :
24195  #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
24196  (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
24197  #endif
24198  PyUnicode_Compare(**name, key);
24199  if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
24200  if (cmp == 0) {
24201  values[name-argnames] = value;
24202  break;
24203  }
24204  name++;
24205  }
24206  if (*name) continue;
24207  else {
24208  PyObject*** argname = argnames;
24209  while (argname != first_kw_arg) {
24210  int cmp = (**argname == key) ? 0 :
24211  #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
24212  (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
24213  #endif
24214  PyUnicode_Compare(**argname, key);
24215  if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
24216  if (cmp == 0) goto arg_passed_twice;
24217  argname++;
24218  }
24219  }
24220  } else
24221  goto invalid_keyword_type;
24222  if (kwds2) {
24223  if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
24224  } else {
24225  goto invalid_keyword;
24226  }
24227  }
24228  return 0;
24229 arg_passed_twice:
24230  __Pyx_RaiseDoubleKeywordsError(function_name, key);
24231  goto bad;
24232 invalid_keyword_type:
24233  PyErr_Format(PyExc_TypeError,
24234  "%.200s() keywords must be strings", function_name);
24235  goto bad;
24236 invalid_keyword:
24237  PyErr_Format(PyExc_TypeError,
24238  #if PY_MAJOR_VERSION < 3
24239  "%.200s() got an unexpected keyword argument '%.200s'",
24240  function_name, PyString_AsString(key));
24241  #else
24242  "%s() got an unexpected keyword argument '%U'",
24243  function_name, key);
24244  #endif
24245 bad:
24246  return -1;
24247 }
24248 
24249 /* ArgTypeTest */
24250 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
24251 {
24252  if (unlikely(!type)) {
24253  PyErr_SetString(PyExc_SystemError, "Missing type object");
24254  return 0;
24255  }
24256  else if (exact) {
24257  #if PY_MAJOR_VERSION == 2
24258  if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
24259  #endif
24260  }
24261  else {
24262  if (likely(__Pyx_TypeCheck(obj, type))) return 1;
24263  }
24264  PyErr_Format(PyExc_TypeError,
24265  "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
24266  name, type->tp_name, Py_TYPE(obj)->tp_name);
24267  return 0;
24268 }
24269 
24270 /* IsLittleEndian */
24271 static CYTHON_INLINE int __Pyx_Is_Little_Endian(void)
24272 {
24273  union {
24274  uint32_t u32;
24275  uint8_t u8[4];
24276  } S;
24277  S.u32 = 0x01020304;
24278  return S.u8[0] == 4;
24279 }
24280 
24281 /* BufferFormatCheck */
24282 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
24283  __Pyx_BufFmt_StackElem* stack,
24284  __Pyx_TypeInfo* type) {
24285  stack[0].field = &ctx->root;
24286  stack[0].parent_offset = 0;
24287  ctx->root.type = type;
24288  ctx->root.name = "buffer dtype";
24289  ctx->root.offset = 0;
24290  ctx->head = stack;
24291  ctx->head->field = &ctx->root;
24292  ctx->fmt_offset = 0;
24293  ctx->head->parent_offset = 0;
24294  ctx->new_packmode = '@';
24295  ctx->enc_packmode = '@';
24296  ctx->new_count = 1;
24297  ctx->enc_count = 0;
24298  ctx->enc_type = 0;
24299  ctx->is_complex = 0;
24300  ctx->is_valid_array = 0;
24301  ctx->struct_alignment = 0;
24302  while (type->typegroup == 'S') {
24303  ++ctx->head;
24304  ctx->head->field = type->fields;
24305  ctx->head->parent_offset = 0;
24306  type = type->fields->type;
24307  }
24308 }
24309 static int __Pyx_BufFmt_ParseNumber(const char** ts) {
24310  int count;
24311  const char* t = *ts;
24312  if (*t < '0' || *t > '9') {
24313  return -1;
24314  } else {
24315  count = *t++ - '0';
24316  while (*t >= '0' && *t <= '9') {
24317  count *= 10;
24318  count += *t++ - '0';
24319  }
24320  }
24321  *ts = t;
24322  return count;
24323 }
24324 static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
24325  int number = __Pyx_BufFmt_ParseNumber(ts);
24326  if (number == -1)
24327  PyErr_Format(PyExc_ValueError,\
24328  "Does not understand character buffer dtype format string ('%c')", **ts);
24329  return number;
24330 }
24331 static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
24332  PyErr_Format(PyExc_ValueError,
24333  "Unexpected format string character: '%c'", ch);
24334 }
24335 static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
24336  switch (ch) {
24337  case '?': return "'bool'";
24338  case 'c': return "'char'";
24339  case 'b': return "'signed char'";
24340  case 'B': return "'unsigned char'";
24341  case 'h': return "'short'";
24342  case 'H': return "'unsigned short'";
24343  case 'i': return "'int'";
24344  case 'I': return "'unsigned int'";
24345  case 'l': return "'long'";
24346  case 'L': return "'unsigned long'";
24347  case 'q': return "'long long'";
24348  case 'Q': return "'unsigned long long'";
24349  case 'f': return (is_complex ? "'complex float'" : "'float'");
24350  case 'd': return (is_complex ? "'complex double'" : "'double'");
24351  case 'g': return (is_complex ? "'complex long double'" : "'long double'");
24352  case 'T': return "a struct";
24353  case 'O': return "Python object";
24354  case 'P': return "a pointer";
24355  case 's': case 'p': return "a string";
24356  case 0: return "end";
24357  default: return "unparseable format string";
24358  }
24359 }
24360 static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
24361  switch (ch) {
24362  case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
24363  case 'h': case 'H': return 2;
24364  case 'i': case 'I': case 'l': case 'L': return 4;
24365  case 'q': case 'Q': return 8;
24366  case 'f': return (is_complex ? 8 : 4);
24367  case 'd': return (is_complex ? 16 : 8);
24368  case 'g': {
24369  PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
24370  return 0;
24371  }
24372  case 'O': case 'P': return sizeof(void*);
24373  default:
24374  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
24375  return 0;
24376  }
24377 }
24378 static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
24379  switch (ch) {
24380  case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
24381  case 'h': case 'H': return sizeof(short);
24382  case 'i': case 'I': return sizeof(int);
24383  case 'l': case 'L': return sizeof(long);
24384  #ifdef HAVE_LONG_LONG
24385  case 'q': case 'Q': return sizeof(PY_LONG_LONG);
24386  #endif
24387  case 'f': return sizeof(float) * (is_complex ? 2 : 1);
24388  case 'd': return sizeof(double) * (is_complex ? 2 : 1);
24389  case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
24390  case 'O': case 'P': return sizeof(void*);
24391  default: {
24392  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
24393  return 0;
24394  }
24395  }
24396 }
24397 typedef struct { char c; short x; } __Pyx_st_short;
24398 typedef struct { char c; int x; } __Pyx_st_int;
24399 typedef struct { char c; long x; } __Pyx_st_long;
24400 typedef struct { char c; float x; } __Pyx_st_float;
24401 typedef struct { char c; double x; } __Pyx_st_double;
24402 typedef struct { char c; long double x; } __Pyx_st_longdouble;
24403 typedef struct { char c; void *x; } __Pyx_st_void_p;
24404 #ifdef HAVE_LONG_LONG
24405 typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
24406 #endif
24407 static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
24408  switch (ch) {
24409  case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
24410  case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
24411  case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
24412  case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
24413 #ifdef HAVE_LONG_LONG
24414  case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
24415 #endif
24416  case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
24417  case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
24418  case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
24419  case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
24420  default:
24421  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
24422  return 0;
24423  }
24424 }
24425 /* These are for computing the padding at the end of the struct to align
24426  on the first member of the struct. This will probably the same as above,
24427  but we don't have any guarantees.
24428  */
24429 typedef struct { short x; char c; } __Pyx_pad_short;
24430 typedef struct { int x; char c; } __Pyx_pad_int;
24431 typedef struct { long x; char c; } __Pyx_pad_long;
24432 typedef struct { float x; char c; } __Pyx_pad_float;
24433 typedef struct { double x; char c; } __Pyx_pad_double;
24434 typedef struct { long double x; char c; } __Pyx_pad_longdouble;
24435 typedef struct { void *x; char c; } __Pyx_pad_void_p;
24436 #ifdef HAVE_LONG_LONG
24437 typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
24438 #endif
24439 static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
24440  switch (ch) {
24441  case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
24442  case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
24443  case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
24444  case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
24445 #ifdef HAVE_LONG_LONG
24446  case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
24447 #endif
24448  case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
24449  case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
24450  case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
24451  case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
24452  default:
24453  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
24454  return 0;
24455  }
24456 }
24457 static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
24458  switch (ch) {
24459  case 'c':
24460  return 'H';
24461  case 'b': case 'h': case 'i':
24462  case 'l': case 'q': case 's': case 'p':
24463  return 'I';
24464  case '?': case 'B': case 'H': case 'I': case 'L': case 'Q':
24465  return 'U';
24466  case 'f': case 'd': case 'g':
24467  return (is_complex ? 'C' : 'R');
24468  case 'O':
24469  return 'O';
24470  case 'P':
24471  return 'P';
24472  default: {
24473  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
24474  return 0;
24475  }
24476  }
24477 }
24478 static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
24479  if (ctx->head == NULL || ctx->head->field == &ctx->root) {
24480  const char* expected;
24481  const char* quote;
24482  if (ctx->head == NULL) {
24483  expected = "end";
24484  quote = "";
24485  } else {
24486  expected = ctx->head->field->type->name;
24487  quote = "'";
24488  }
24489  PyErr_Format(PyExc_ValueError,
24490  "Buffer dtype mismatch, expected %s%s%s but got %s",
24491  quote, expected, quote,
24492  __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
24493  } else {
24494  __Pyx_StructField* field = ctx->head->field;
24495  __Pyx_StructField* parent = (ctx->head - 1)->field;
24496  PyErr_Format(PyExc_ValueError,
24497  "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
24498  field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
24499  parent->type->name, field->name);
24500  }
24501 }
24502 static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
24503  char group;
24504  size_t size, offset, arraysize = 1;
24505  if (ctx->enc_type == 0) return 0;
24506  if (ctx->head->field->type->arraysize[0]) {
24507  int i, ndim = 0;
24508  if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
24509  ctx->is_valid_array = ctx->head->field->type->ndim == 1;
24510  ndim = 1;
24511  if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
24512  PyErr_Format(PyExc_ValueError,
24513  "Expected a dimension of size %zu, got %zu",
24514  ctx->head->field->type->arraysize[0], ctx->enc_count);
24515  return -1;
24516  }
24517  }
24518  if (!ctx->is_valid_array) {
24519  PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
24520  ctx->head->field->type->ndim, ndim);
24521  return -1;
24522  }
24523  for (i = 0; i < ctx->head->field->type->ndim; i++) {
24524  arraysize *= ctx->head->field->type->arraysize[i];
24525  }
24526  ctx->is_valid_array = 0;
24527  ctx->enc_count = 1;
24528  }
24529  group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
24530  do {
24531  __Pyx_StructField* field = ctx->head->field;
24532  __Pyx_TypeInfo* type = field->type;
24533  if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
24534  size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
24535  } else {
24536  size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
24537  }
24538  if (ctx->enc_packmode == '@') {
24539  size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
24540  size_t align_mod_offset;
24541  if (align_at == 0) return -1;
24542  align_mod_offset = ctx->fmt_offset % align_at;
24543  if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
24544  if (ctx->struct_alignment == 0)
24545  ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
24546  ctx->is_complex);
24547  }
24548  if (type->size != size || type->typegroup != group) {
24549  if (type->typegroup == 'C' && type->fields != NULL) {
24550  size_t parent_offset = ctx->head->parent_offset + field->offset;
24551  ++ctx->head;
24552  ctx->head->field = type->fields;
24553  ctx->head->parent_offset = parent_offset;
24554  continue;
24555  }
24556  if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
24557  } else {
24558  __Pyx_BufFmt_RaiseExpected(ctx);
24559  return -1;
24560  }
24561  }
24562  offset = ctx->head->parent_offset + field->offset;
24563  if (ctx->fmt_offset != offset) {
24564  PyErr_Format(PyExc_ValueError,
24565  "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
24566  (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
24567  return -1;
24568  }
24569  ctx->fmt_offset += size;
24570  if (arraysize)
24571  ctx->fmt_offset += (arraysize - 1) * size;
24572  --ctx->enc_count;
24573  while (1) {
24574  if (field == &ctx->root) {
24575  ctx->head = NULL;
24576  if (ctx->enc_count != 0) {
24577  __Pyx_BufFmt_RaiseExpected(ctx);
24578  return -1;
24579  }
24580  break;
24581  }
24582  ctx->head->field = ++field;
24583  if (field->type == NULL) {
24584  --ctx->head;
24585  field = ctx->head->field;
24586  continue;
24587  } else if (field->type->typegroup == 'S') {
24588  size_t parent_offset = ctx->head->parent_offset + field->offset;
24589  if (field->type->fields->type == NULL) continue;
24590  field = field->type->fields;
24591  ++ctx->head;
24592  ctx->head->field = field;
24593  ctx->head->parent_offset = parent_offset;
24594  break;
24595  } else {
24596  break;
24597  }
24598  }
24599  } while (ctx->enc_count);
24600  ctx->enc_type = 0;
24601  ctx->is_complex = 0;
24602  return 0;
24603 }
24604 static PyObject *
24605 __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
24606 {
24607  const char *ts = *tsp;
24608  int i = 0, number, ndim;
24609  ++ts;
24610  if (ctx->new_count != 1) {
24611  PyErr_SetString(PyExc_ValueError,
24612  "Cannot handle repeated arrays in format string");
24613  return NULL;
24614  }
24615  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
24616  ndim = ctx->head->field->type->ndim;
24617  while (*ts && *ts != ')') {
24618  switch (*ts) {
24619  case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue;
24620  default: break;
24621  }
24622  number = __Pyx_BufFmt_ExpectNumber(&ts);
24623  if (number == -1) return NULL;
24624  if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
24625  return PyErr_Format(PyExc_ValueError,
24626  "Expected a dimension of size %zu, got %d",
24627  ctx->head->field->type->arraysize[i], number);
24628  if (*ts != ',' && *ts != ')')
24629  return PyErr_Format(PyExc_ValueError,
24630  "Expected a comma in format string, got '%c'", *ts);
24631  if (*ts == ',') ts++;
24632  i++;
24633  }
24634  if (i != ndim)
24635  return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
24636  ctx->head->field->type->ndim, i);
24637  if (!*ts) {
24638  PyErr_SetString(PyExc_ValueError,
24639  "Unexpected end of format string, expected ')'");
24640  return NULL;
24641  }
24642  ctx->is_valid_array = 1;
24643  ctx->new_count = 1;
24644  *tsp = ++ts;
24645  return Py_None;
24646 }
24647 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
24648  int got_Z = 0;
24649  while (1) {
24650  switch(*ts) {
24651  case 0:
24652  if (ctx->enc_type != 0 && ctx->head == NULL) {
24653  __Pyx_BufFmt_RaiseExpected(ctx);
24654  return NULL;
24655  }
24656  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
24657  if (ctx->head != NULL) {
24658  __Pyx_BufFmt_RaiseExpected(ctx);
24659  return NULL;
24660  }
24661  return ts;
24662  case ' ':
24663  case '\r':
24664  case '\n':
24665  ++ts;
24666  break;
24667  case '<':
24668  if (!__Pyx_Is_Little_Endian()) {
24669  PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
24670  return NULL;
24671  }
24672  ctx->new_packmode = '=';
24673  ++ts;
24674  break;
24675  case '>':
24676  case '!':
24677  if (__Pyx_Is_Little_Endian()) {
24678  PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
24679  return NULL;
24680  }
24681  ctx->new_packmode = '=';
24682  ++ts;
24683  break;
24684  case '=':
24685  case '@':
24686  case '^':
24687  ctx->new_packmode = *ts++;
24688  break;
24689  case 'T':
24690  {
24691  const char* ts_after_sub;
24692  size_t i, struct_count = ctx->new_count;
24693  size_t struct_alignment = ctx->struct_alignment;
24694  ctx->new_count = 1;
24695  ++ts;
24696  if (*ts != '{') {
24697  PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
24698  return NULL;
24699  }
24700  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
24701  ctx->enc_type = 0;
24702  ctx->enc_count = 0;
24703  ctx->struct_alignment = 0;
24704  ++ts;
24705  ts_after_sub = ts;
24706  for (i = 0; i != struct_count; ++i) {
24707  ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
24708  if (!ts_after_sub) return NULL;
24709  }
24710  ts = ts_after_sub;
24711  if (struct_alignment) ctx->struct_alignment = struct_alignment;
24712  }
24713  break;
24714  case '}':
24715  {
24716  size_t alignment = ctx->struct_alignment;
24717  ++ts;
24718  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
24719  ctx->enc_type = 0;
24720  if (alignment && ctx->fmt_offset % alignment) {
24721  ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
24722  }
24723  }
24724  return ts;
24725  case 'x':
24726  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
24727  ctx->fmt_offset += ctx->new_count;
24728  ctx->new_count = 1;
24729  ctx->enc_count = 0;
24730  ctx->enc_type = 0;
24731  ctx->enc_packmode = ctx->new_packmode;
24732  ++ts;
24733  break;
24734  case 'Z':
24735  got_Z = 1;
24736  ++ts;
24737  if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
24738  __Pyx_BufFmt_RaiseUnexpectedChar('Z');
24739  return NULL;
24740  }
24741  CYTHON_FALLTHROUGH;
24742  case '?': case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
24743  case 'l': case 'L': case 'q': case 'Q':
24744  case 'f': case 'd': case 'g':
24745  case 'O': case 'p':
24746  if ((ctx->enc_type == *ts) && (got_Z == ctx->is_complex) &&
24747  (ctx->enc_packmode == ctx->new_packmode) && (!ctx->is_valid_array)) {
24748  ctx->enc_count += ctx->new_count;
24749  ctx->new_count = 1;
24750  got_Z = 0;
24751  ++ts;
24752  break;
24753  }
24754  CYTHON_FALLTHROUGH;
24755  case 's':
24756  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
24757  ctx->enc_count = ctx->new_count;
24758  ctx->enc_packmode = ctx->new_packmode;
24759  ctx->enc_type = *ts;
24760  ctx->is_complex = got_Z;
24761  ++ts;
24762  ctx->new_count = 1;
24763  got_Z = 0;
24764  break;
24765  case ':':
24766  ++ts;
24767  while(*ts != ':') ++ts;
24768  ++ts;
24769  break;
24770  case '(':
24771  if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
24772  break;
24773  default:
24774  {
24775  int number = __Pyx_BufFmt_ExpectNumber(&ts);
24776  if (number == -1) return NULL;
24777  ctx->new_count = (size_t)number;
24778  }
24779  }
24780  }
24781 }
24782 
24783 /* BufferGetAndValidate */
24784  static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
24785  if (unlikely(info->buf == NULL)) return;
24786  if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
24787  __Pyx_ReleaseBuffer(info);
24788 }
24789 static void __Pyx_ZeroBuffer(Py_buffer* buf) {
24790  buf->buf = NULL;
24791  buf->obj = NULL;
24792  buf->strides = __Pyx_zeros;
24793  buf->shape = __Pyx_zeros;
24794  buf->suboffsets = __Pyx_minusones;
24795 }
24796 static int __Pyx__GetBufferAndValidate(
24797  Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags,
24798  int nd, int cast, __Pyx_BufFmt_StackElem* stack)
24799 {
24800  buf->buf = NULL;
24801  if (unlikely(__Pyx_GetBuffer(obj, buf, flags) == -1)) {
24802  __Pyx_ZeroBuffer(buf);
24803  return -1;
24804  }
24805  if (unlikely(buf->ndim != nd)) {
24806  PyErr_Format(PyExc_ValueError,
24807  "Buffer has wrong number of dimensions (expected %d, got %d)",
24808  nd, buf->ndim);
24809  goto fail;
24810  }
24811  if (!cast) {
24812  __Pyx_BufFmt_Context ctx;
24813  __Pyx_BufFmt_Init(&ctx, stack, dtype);
24814  if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
24815  }
24816  if (unlikely((size_t)buf->itemsize != dtype->size)) {
24817  PyErr_Format(PyExc_ValueError,
24818  "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)",
24819  buf->itemsize, (buf->itemsize > 1) ? "s" : "",
24820  dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
24821  goto fail;
24822  }
24823  if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
24824  return 0;
24825 fail:;
24826  __Pyx_SafeReleaseBuffer(buf);
24827  return -1;
24828 }
24829 
24830 /* BufferIndexError */
24831  static void __Pyx_RaiseBufferIndexError(int axis) {
24832  PyErr_Format(PyExc_IndexError,
24833  "Out of bounds on buffer access (axis %d)", axis);
24834 }
24835 
24836 /* PyErrFetchRestore */
24837  #if CYTHON_FAST_THREAD_STATE
24838 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
24839  PyObject *tmp_type, *tmp_value, *tmp_tb;
24840  tmp_type = tstate->curexc_type;
24841  tmp_value = tstate->curexc_value;
24842  tmp_tb = tstate->curexc_traceback;
24843  tstate->curexc_type = type;
24844  tstate->curexc_value = value;
24845  tstate->curexc_traceback = tb;
24846  Py_XDECREF(tmp_type);
24847  Py_XDECREF(tmp_value);
24848  Py_XDECREF(tmp_tb);
24849 }
24850 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
24851  *type = tstate->curexc_type;
24852  *value = tstate->curexc_value;
24853  *tb = tstate->curexc_traceback;
24854  tstate->curexc_type = 0;
24855  tstate->curexc_value = 0;
24856  tstate->curexc_traceback = 0;
24857 }
24858 #endif
24859 
24860 /* DictGetItem */
24861  #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
24862 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
24863  PyObject *value;
24864  value = PyDict_GetItemWithError(d, key);
24865  if (unlikely(!value)) {
24866  if (!PyErr_Occurred()) {
24867  if (unlikely(PyTuple_Check(key))) {
24868  PyObject* args = PyTuple_Pack(1, key);
24869  if (likely(args)) {
24870  PyErr_SetObject(PyExc_KeyError, args);
24871  Py_DECREF(args);
24872  }
24873  } else {
24874  PyErr_SetObject(PyExc_KeyError, key);
24875  }
24876  }
24877  return NULL;
24878  }
24879  Py_INCREF(value);
24880  return value;
24881 }
24882 #endif
24883 
24884 /* GetItemInt */
24885  static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
24886  PyObject *r;
24887  if (!j) return NULL;
24888  r = PyObject_GetItem(o, j);
24889  Py_DECREF(j);
24890  return r;
24891 }
24892 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
24893  CYTHON_NCP_UNUSED int wraparound,
24894  CYTHON_NCP_UNUSED int boundscheck) {
24895 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
24896  Py_ssize_t wrapped_i = i;
24897  if (wraparound & unlikely(i < 0)) {
24898  wrapped_i += PyList_GET_SIZE(o);
24899  }
24900  if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
24901  PyObject *r = PyList_GET_ITEM(o, wrapped_i);
24902  Py_INCREF(r);
24903  return r;
24904  }
24905  return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
24906 #else
24907  return PySequence_GetItem(o, i);
24908 #endif
24909 }
24910 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
24911  CYTHON_NCP_UNUSED int wraparound,
24912  CYTHON_NCP_UNUSED int boundscheck) {
24913 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
24914  Py_ssize_t wrapped_i = i;
24915  if (wraparound & unlikely(i < 0)) {
24916  wrapped_i += PyTuple_GET_SIZE(o);
24917  }
24918  if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
24919  PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
24920  Py_INCREF(r);
24921  return r;
24922  }
24923  return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
24924 #else
24925  return PySequence_GetItem(o, i);
24926 #endif
24927 }
24928 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
24929  CYTHON_NCP_UNUSED int wraparound,
24930  CYTHON_NCP_UNUSED int boundscheck) {
24931 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
24932  if (is_list || PyList_CheckExact(o)) {
24933  Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
24934  if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
24935  PyObject *r = PyList_GET_ITEM(o, n);
24936  Py_INCREF(r);
24937  return r;
24938  }
24939  }
24940  else if (PyTuple_CheckExact(o)) {
24941  Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
24942  if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
24943  PyObject *r = PyTuple_GET_ITEM(o, n);
24944  Py_INCREF(r);
24945  return r;
24946  }
24947  } else {
24948  PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
24949  if (likely(m && m->sq_item)) {
24950  if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
24951  Py_ssize_t l = m->sq_length(o);
24952  if (likely(l >= 0)) {
24953  i += l;
24954  } else {
24955  if (!PyErr_ExceptionMatches(PyExc_OverflowError))
24956  return NULL;
24957  PyErr_Clear();
24958  }
24959  }
24960  return m->sq_item(o, i);
24961  }
24962  }
24963 #else
24964  if (is_list || PySequence_Check(o)) {
24965  return PySequence_GetItem(o, i);
24966  }
24967 #endif
24968  return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
24969 }
24970 
24971 /* ObjectGetItem */
24972  #if CYTHON_USE_TYPE_SLOTS
24973 static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
24974  PyObject *runerr;
24975  Py_ssize_t key_value;
24976  PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
24977  if (unlikely(!(m && m->sq_item))) {
24978  PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
24979  return NULL;
24980  }
24981  key_value = __Pyx_PyIndex_AsSsize_t(index);
24982  if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
24983  return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
24984  }
24985  if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
24986  PyErr_Clear();
24987  PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
24988  }
24989  return NULL;
24990 }
24991 static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
24992  PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
24993  if (likely(m && m->mp_subscript)) {
24994  return m->mp_subscript(obj, key);
24995  }
24996  return __Pyx_PyObject_GetIndex(obj, key);
24997 }
24998 #endif
24999 
25000 /* PyFloatBinop */
25001  #if !CYTHON_COMPILING_IN_PYPY
25002 static PyObject* __Pyx_PyFloat_AddObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check) {
25003  const double b = floatval;
25004  double a, result;
25005  (void)inplace;
25006  (void)zerodivision_check;
25007  if (likely(PyFloat_CheckExact(op1))) {
25008  a = PyFloat_AS_DOUBLE(op1);
25009 
25010  } else
25011  #if PY_MAJOR_VERSION < 3
25012  if (likely(PyInt_CheckExact(op1))) {
25013  a = (double) PyInt_AS_LONG(op1);
25014 
25015  } else
25016  #endif
25017  if (likely(PyLong_CheckExact(op1))) {
25018  #if CYTHON_USE_PYLONG_INTERNALS
25019  const digit* digits = ((PyLongObject*)op1)->ob_digit;
25020  const Py_ssize_t size = Py_SIZE(op1);
25021  switch (size) {
25022  case 0: a = 0.0; break;
25023  case -1: a = -(double) digits[0]; break;
25024  case 1: a = (double) digits[0]; break;
25025  case -2:
25026  case 2:
25027  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
25028  a = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
25029  if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
25030  if (size == -2)
25031  a = -a;
25032  break;
25033  }
25034  }
25035  CYTHON_FALLTHROUGH;
25036  case -3:
25037  case 3:
25038  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
25039  a = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
25040  if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
25041  if (size == -3)
25042  a = -a;
25043  break;
25044  }
25045  }
25046  CYTHON_FALLTHROUGH;
25047  case -4:
25048  case 4:
25049  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
25050  a = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
25051  if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
25052  if (size == -4)
25053  a = -a;
25054  break;
25055  }
25056  }
25057  CYTHON_FALLTHROUGH;
25058  default:
25059  #else
25060  {
25061  #endif
25062  a = PyLong_AsDouble(op1);
25063  if (unlikely(a == -1.0 && PyErr_Occurred())) return NULL;
25064 
25065  }
25066  } else {
25067  return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
25068  }
25069 
25070  PyFPE_START_PROTECT("add", return NULL)
25071  result = a + b;
25072  PyFPE_END_PROTECT(result)
25073  return PyFloat_FromDouble(result);
25074 }
25075 #endif
25076 
25077 /* PyFunctionFastCall */
25078  #if CYTHON_FAST_PYCALL
25079 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
25080  PyObject *globals) {
25081  PyFrameObject *f;
25082  PyThreadState *tstate = __Pyx_PyThreadState_Current;
25083  PyObject **fastlocals;
25084  Py_ssize_t i;
25085  PyObject *result;
25086  assert(globals != NULL);
25087  /* XXX Perhaps we should create a specialized
25088  PyFrame_New() that doesn't take locals, but does
25089  take builtins without sanity checking them.
25090  */
25091  assert(tstate != NULL);
25092  f = PyFrame_New(tstate, co, globals, NULL);
25093  if (f == NULL) {
25094  return NULL;
25095  }
25096  fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
25097  for (i = 0; i < na; i++) {
25098  Py_INCREF(*args);
25099  fastlocals[i] = *args++;
25100  }
25101  result = PyEval_EvalFrameEx(f,0);
25102  ++tstate->recursion_depth;
25103  Py_DECREF(f);
25104  --tstate->recursion_depth;
25105  return result;
25106 }
25107 #if 1 || PY_VERSION_HEX < 0x030600B1
25108 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
25109  PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
25110  PyObject *globals = PyFunction_GET_GLOBALS(func);
25111  PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
25112  PyObject *closure;
25113 #if PY_MAJOR_VERSION >= 3
25114  PyObject *kwdefs;
25115 #endif
25116  PyObject *kwtuple, **k;
25117  PyObject **d;
25118  Py_ssize_t nd;
25119  Py_ssize_t nk;
25120  PyObject *result;
25121  assert(kwargs == NULL || PyDict_Check(kwargs));
25122  nk = kwargs ? PyDict_Size(kwargs) : 0;
25123  if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
25124  return NULL;
25125  }
25126  if (
25127 #if PY_MAJOR_VERSION >= 3
25128  co->co_kwonlyargcount == 0 &&
25129 #endif
25130  likely(kwargs == NULL || nk == 0) &&
25131  co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
25132  if (argdefs == NULL && co->co_argcount == nargs) {
25133  result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
25134  goto done;
25135  }
25136  else if (nargs == 0 && argdefs != NULL
25137  && co->co_argcount == Py_SIZE(argdefs)) {
25138  /* function called with no arguments, but all parameters have
25139  a default value: use default values as arguments .*/
25140  args = &PyTuple_GET_ITEM(argdefs, 0);
25141  result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
25142  goto done;
25143  }
25144  }
25145  if (kwargs != NULL) {
25146  Py_ssize_t pos, i;
25147  kwtuple = PyTuple_New(2 * nk);
25148  if (kwtuple == NULL) {
25149  result = NULL;
25150  goto done;
25151  }
25152  k = &PyTuple_GET_ITEM(kwtuple, 0);
25153  pos = i = 0;
25154  while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
25155  Py_INCREF(k[i]);
25156  Py_INCREF(k[i+1]);
25157  i += 2;
25158  }
25159  nk = i / 2;
25160  }
25161  else {
25162  kwtuple = NULL;
25163  k = NULL;
25164  }
25165  closure = PyFunction_GET_CLOSURE(func);
25166 #if PY_MAJOR_VERSION >= 3
25167  kwdefs = PyFunction_GET_KW_DEFAULTS(func);
25168 #endif
25169  if (argdefs != NULL) {
25170  d = &PyTuple_GET_ITEM(argdefs, 0);
25171  nd = Py_SIZE(argdefs);
25172  }
25173  else {
25174  d = NULL;
25175  nd = 0;
25176  }
25177 #if PY_MAJOR_VERSION >= 3
25178  result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
25179  args, (int)nargs,
25180  k, (int)nk,
25181  d, (int)nd, kwdefs, closure);
25182 #else
25183  result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
25184  args, (int)nargs,
25185  k, (int)nk,
25186  d, (int)nd, closure);
25187 #endif
25188  Py_XDECREF(kwtuple);
25189 done:
25190  Py_LeaveRecursiveCall();
25191  return result;
25192 }
25193 #endif
25194 #endif
25195 
25196 /* PyCFunctionFastCall */
25197  #if CYTHON_FAST_PYCCALL
25198 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
25199  PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
25200  PyCFunction meth = PyCFunction_GET_FUNCTION(func);
25201  PyObject *self = PyCFunction_GET_SELF(func);
25202  int flags = PyCFunction_GET_FLAGS(func);
25203  assert(PyCFunction_Check(func));
25204  assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
25205  assert(nargs >= 0);
25206  assert(nargs == 0 || args != NULL);
25207  /* _PyCFunction_FastCallDict() must not be called with an exception set,
25208  because it may clear it (directly or indirectly) and so the
25209  caller loses its exception */
25210  assert(!PyErr_Occurred());
25211  if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
25212  return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
25213  } else {
25214  return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
25215  }
25216 }
25217 #endif
25218 
25219 /* PyObjectCall */
25220  #if CYTHON_COMPILING_IN_CPYTHON
25221 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
25222  PyObject *result;
25223  ternaryfunc call = func->ob_type->tp_call;
25224  if (unlikely(!call))
25225  return PyObject_Call(func, arg, kw);
25226  if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
25227  return NULL;
25228  result = (*call)(func, arg, kw);
25229  Py_LeaveRecursiveCall();
25230  if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
25231  PyErr_SetString(
25232  PyExc_SystemError,
25233  "NULL result without error in PyObject_Call");
25234  }
25235  return result;
25236 }
25237 #endif
25238 
25239 /* PyDictVersioning */
25240  #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
25241 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
25242  PyObject *dict = Py_TYPE(obj)->tp_dict;
25243  return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
25244 }
25245 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
25246  PyObject **dictptr = NULL;
25247  Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
25248  if (offset) {
25249 #if CYTHON_COMPILING_IN_CPYTHON
25250  dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
25251 #else
25252  dictptr = _PyObject_GetDictPtr(obj);
25253 #endif
25254  }
25255  return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
25256 }
25257 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
25258  PyObject *dict = Py_TYPE(obj)->tp_dict;
25259  if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
25260  return 0;
25261  return obj_dict_version == __Pyx_get_object_dict_version(obj);
25262 }
25263 #endif
25264 
25265 /* GetModuleGlobalName */
25266  #if CYTHON_USE_DICT_VERSIONS
25267 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
25268 #else
25269 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
25270 #endif
25271 {
25272  PyObject *result;
25273 #if !CYTHON_AVOID_BORROWED_REFS
25274 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
25275  result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
25276  __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
25277  if (likely(result)) {
25278  return __Pyx_NewRef(result);
25279  } else if (unlikely(PyErr_Occurred())) {
25280  return NULL;
25281  }
25282 #else
25283  result = PyDict_GetItem(__pyx_d, name);
25284  __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
25285  if (likely(result)) {
25286  return __Pyx_NewRef(result);
25287  }
25288 #endif
25289 #else
25290  result = PyObject_GetItem(__pyx_d, name);
25291  __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
25292  if (likely(result)) {
25293  return __Pyx_NewRef(result);
25294  }
25295  PyErr_Clear();
25296 #endif
25297  return __Pyx_GetBuiltinName(name);
25298 }
25299 
25300 /* ExtTypeTest */
25301  static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
25302  if (unlikely(!type)) {
25303  PyErr_SetString(PyExc_SystemError, "Missing type object");
25304  return 0;
25305  }
25306  if (likely(__Pyx_TypeCheck(obj, type)))
25307  return 1;
25308  PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
25309  Py_TYPE(obj)->tp_name, type->tp_name);
25310  return 0;
25311 }
25312 
25313 /* PyObjectCall2Args */
25314  static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
25315  PyObject *args, *result = NULL;
25316  #if CYTHON_FAST_PYCALL
25317  if (PyFunction_Check(function)) {
25318  PyObject *args[2] = {arg1, arg2};
25319  return __Pyx_PyFunction_FastCall(function, args, 2);
25320  }
25321  #endif
25322  #if CYTHON_FAST_PYCCALL
25323  if (__Pyx_PyFastCFunction_Check(function)) {
25324  PyObject *args[2] = {arg1, arg2};
25325  return __Pyx_PyCFunction_FastCall(function, args, 2);
25326  }
25327  #endif
25328  args = PyTuple_New(2);
25329  if (unlikely(!args)) goto done;
25330  Py_INCREF(arg1);
25331  PyTuple_SET_ITEM(args, 0, arg1);
25332  Py_INCREF(arg2);
25333  PyTuple_SET_ITEM(args, 1, arg2);
25334  Py_INCREF(function);
25335  result = __Pyx_PyObject_Call(function, args, NULL);
25336  Py_DECREF(args);
25337  Py_DECREF(function);
25338 done:
25339  return result;
25340 }
25341 
25342 /* PyObjectCallMethO */
25343  #if CYTHON_COMPILING_IN_CPYTHON
25344 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
25345  PyObject *self, *result;
25346  PyCFunction cfunc;
25347  cfunc = PyCFunction_GET_FUNCTION(func);
25348  self = PyCFunction_GET_SELF(func);
25349  if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
25350  return NULL;
25351  result = cfunc(self, arg);
25352  Py_LeaveRecursiveCall();
25353  if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
25354  PyErr_SetString(
25355  PyExc_SystemError,
25356  "NULL result without error in PyObject_Call");
25357  }
25358  return result;
25359 }
25360 #endif
25361 
25362 /* PyObjectCallOneArg */
25363  #if CYTHON_COMPILING_IN_CPYTHON
25364 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
25365  PyObject *result;
25366  PyObject *args = PyTuple_New(1);
25367  if (unlikely(!args)) return NULL;
25368  Py_INCREF(arg);
25369  PyTuple_SET_ITEM(args, 0, arg);
25370  result = __Pyx_PyObject_Call(func, args, NULL);
25371  Py_DECREF(args);
25372  return result;
25373 }
25374 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
25375 #if CYTHON_FAST_PYCALL
25376  if (PyFunction_Check(func)) {
25377  return __Pyx_PyFunction_FastCall(func, &arg, 1);
25378  }
25379 #endif
25380  if (likely(PyCFunction_Check(func))) {
25381  if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
25382  return __Pyx_PyObject_CallMethO(func, arg);
25383 #if CYTHON_FAST_PYCCALL
25384  } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
25385  return __Pyx_PyCFunction_FastCall(func, &arg, 1);
25386 #endif
25387  }
25388  }
25389  return __Pyx__PyObject_CallOneArg(func, arg);
25390 }
25391 #else
25392 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
25393  PyObject *result;
25394  PyObject *args = PyTuple_Pack(1, arg);
25395  if (unlikely(!args)) return NULL;
25396  result = __Pyx_PyObject_Call(func, args, NULL);
25397  Py_DECREF(args);
25398  return result;
25399 }
25400 #endif
25401 
25402 /* pyobject_as_double */
25403  static double __Pyx__PyObject_AsDouble(PyObject* obj) {
25404  PyObject* float_value;
25405 #if !CYTHON_USE_TYPE_SLOTS
25406  float_value = PyNumber_Float(obj); if ((0)) goto bad;
25407 #else
25408  PyNumberMethods *nb = Py_TYPE(obj)->tp_as_number;
25409  if (likely(nb) && likely(nb->nb_float)) {
25410  float_value = nb->nb_float(obj);
25411  if (likely(float_value) && unlikely(!PyFloat_Check(float_value))) {
25412  PyErr_Format(PyExc_TypeError,
25413  "__float__ returned non-float (type %.200s)",
25414  Py_TYPE(float_value)->tp_name);
25415  Py_DECREF(float_value);
25416  goto bad;
25417  }
25418  } else if (PyUnicode_CheckExact(obj) || PyBytes_CheckExact(obj)) {
25419 #if PY_MAJOR_VERSION >= 3
25420  float_value = PyFloat_FromString(obj);
25421 #else
25422  float_value = PyFloat_FromString(obj, 0);
25423 #endif
25424  } else {
25425  PyObject* args = PyTuple_New(1);
25426  if (unlikely(!args)) goto bad;
25427  PyTuple_SET_ITEM(args, 0, obj);
25428  float_value = PyObject_Call((PyObject*)&PyFloat_Type, args, 0);
25429  PyTuple_SET_ITEM(args, 0, 0);
25430  Py_DECREF(args);
25431  }
25432 #endif
25433  if (likely(float_value)) {
25434  double value = PyFloat_AS_DOUBLE(float_value);
25435  Py_DECREF(float_value);
25436  return value;
25437  }
25438 bad:
25439  return (double)-1;
25440 }
25441 
25442 /* RaiseTooManyValuesToUnpack */
25443  static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
25444  PyErr_Format(PyExc_ValueError,
25445  "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
25446 }
25447 
25448 /* RaiseNeedMoreValuesToUnpack */
25449  static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
25450  PyErr_Format(PyExc_ValueError,
25451  "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
25452  index, (index == 1) ? "" : "s");
25453 }
25454 
25455 /* RaiseNoneIterError */
25456  static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
25457  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
25458 }
25459 
25460 /* RaiseException */
25461  #if PY_MAJOR_VERSION < 3
25462 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
25463  CYTHON_UNUSED PyObject *cause) {
25464  __Pyx_PyThreadState_declare
25465  Py_XINCREF(type);
25466  if (!value || value == Py_None)
25467  value = NULL;
25468  else
25469  Py_INCREF(value);
25470  if (!tb || tb == Py_None)
25471  tb = NULL;
25472  else {
25473  Py_INCREF(tb);
25474  if (!PyTraceBack_Check(tb)) {
25475  PyErr_SetString(PyExc_TypeError,
25476  "raise: arg 3 must be a traceback or None");
25477  goto raise_error;
25478  }
25479  }
25480  if (PyType_Check(type)) {
25481 #if CYTHON_COMPILING_IN_PYPY
25482  if (!value) {
25483  Py_INCREF(Py_None);
25484  value = Py_None;
25485  }
25486 #endif
25487  PyErr_NormalizeException(&type, &value, &tb);
25488  } else {
25489  if (value) {
25490  PyErr_SetString(PyExc_TypeError,
25491  "instance exception may not have a separate value");
25492  goto raise_error;
25493  }
25494  value = type;
25495  type = (PyObject*) Py_TYPE(type);
25496  Py_INCREF(type);
25497  if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
25498  PyErr_SetString(PyExc_TypeError,
25499  "raise: exception class must be a subclass of BaseException");
25500  goto raise_error;
25501  }
25502  }
25503  __Pyx_PyThreadState_assign
25504  __Pyx_ErrRestore(type, value, tb);
25505  return;
25506 raise_error:
25507  Py_XDECREF(value);
25508  Py_XDECREF(type);
25509  Py_XDECREF(tb);
25510  return;
25511 }
25512 #else
25513 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
25514  PyObject* owned_instance = NULL;
25515  if (tb == Py_None) {
25516  tb = 0;
25517  } else if (tb && !PyTraceBack_Check(tb)) {
25518  PyErr_SetString(PyExc_TypeError,
25519  "raise: arg 3 must be a traceback or None");
25520  goto bad;
25521  }
25522  if (value == Py_None)
25523  value = 0;
25524  if (PyExceptionInstance_Check(type)) {
25525  if (value) {
25526  PyErr_SetString(PyExc_TypeError,
25527  "instance exception may not have a separate value");
25528  goto bad;
25529  }
25530  value = type;
25531  type = (PyObject*) Py_TYPE(value);
25532  } else if (PyExceptionClass_Check(type)) {
25533  PyObject *instance_class = NULL;
25534  if (value && PyExceptionInstance_Check(value)) {
25535  instance_class = (PyObject*) Py_TYPE(value);
25536  if (instance_class != type) {
25537  int is_subclass = PyObject_IsSubclass(instance_class, type);
25538  if (!is_subclass) {
25539  instance_class = NULL;
25540  } else if (unlikely(is_subclass == -1)) {
25541  goto bad;
25542  } else {
25543  type = instance_class;
25544  }
25545  }
25546  }
25547  if (!instance_class) {
25548  PyObject *args;
25549  if (!value)
25550  args = PyTuple_New(0);
25551  else if (PyTuple_Check(value)) {
25552  Py_INCREF(value);
25553  args = value;
25554  } else
25555  args = PyTuple_Pack(1, value);
25556  if (!args)
25557  goto bad;
25558  owned_instance = PyObject_Call(type, args, NULL);
25559  Py_DECREF(args);
25560  if (!owned_instance)
25561  goto bad;
25562  value = owned_instance;
25563  if (!PyExceptionInstance_Check(value)) {
25564  PyErr_Format(PyExc_TypeError,
25565  "calling %R should have returned an instance of "
25566  "BaseException, not %R",
25567  type, Py_TYPE(value));
25568  goto bad;
25569  }
25570  }
25571  } else {
25572  PyErr_SetString(PyExc_TypeError,
25573  "raise: exception class must be a subclass of BaseException");
25574  goto bad;
25575  }
25576  if (cause) {
25577  PyObject *fixed_cause;
25578  if (cause == Py_None) {
25579  fixed_cause = NULL;
25580  } else if (PyExceptionClass_Check(cause)) {
25581  fixed_cause = PyObject_CallObject(cause, NULL);
25582  if (fixed_cause == NULL)
25583  goto bad;
25584  } else if (PyExceptionInstance_Check(cause)) {
25585  fixed_cause = cause;
25586  Py_INCREF(fixed_cause);
25587  } else {
25588  PyErr_SetString(PyExc_TypeError,
25589  "exception causes must derive from "
25590  "BaseException");
25591  goto bad;
25592  }
25593  PyException_SetCause(value, fixed_cause);
25594  }
25595  PyErr_SetObject(type, value);
25596  if (tb) {
25597 #if CYTHON_COMPILING_IN_PYPY
25598  PyObject *tmp_type, *tmp_value, *tmp_tb;
25599  PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
25600  Py_INCREF(tb);
25601  PyErr_Restore(tmp_type, tmp_value, tb);
25602  Py_XDECREF(tmp_tb);
25603 #else
25604  PyThreadState *tstate = __Pyx_PyThreadState_Current;
25605  PyObject* tmp_tb = tstate->curexc_traceback;
25606  if (tb != tmp_tb) {
25607  Py_INCREF(tb);
25608  tstate->curexc_traceback = tb;
25609  Py_XDECREF(tmp_tb);
25610  }
25611 #endif
25612  }
25613 bad:
25614  Py_XDECREF(owned_instance);
25615  return;
25616 }
25617 #endif
25618 
25619 /* GetTopmostException */
25620  #if CYTHON_USE_EXC_INFO_STACK
25621 static _PyErr_StackItem *
25622 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
25623 {
25624  _PyErr_StackItem *exc_info = tstate->exc_info;
25625  while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
25626  exc_info->previous_item != NULL)
25627  {
25628  exc_info = exc_info->previous_item;
25629  }
25630  return exc_info;
25631 }
25632 #endif
25633 
25634 /* SaveResetException */
25635  #if CYTHON_FAST_THREAD_STATE
25636 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
25637  #if CYTHON_USE_EXC_INFO_STACK
25638  _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
25639  *type = exc_info->exc_type;
25640  *value = exc_info->exc_value;
25641  *tb = exc_info->exc_traceback;
25642  #else
25643  *type = tstate->exc_type;
25644  *value = tstate->exc_value;
25645  *tb = tstate->exc_traceback;
25646  #endif
25647  Py_XINCREF(*type);
25648  Py_XINCREF(*value);
25649  Py_XINCREF(*tb);
25650 }
25651 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
25652  PyObject *tmp_type, *tmp_value, *tmp_tb;
25653  #if CYTHON_USE_EXC_INFO_STACK
25654  _PyErr_StackItem *exc_info = tstate->exc_info;
25655  tmp_type = exc_info->exc_type;
25656  tmp_value = exc_info->exc_value;
25657  tmp_tb = exc_info->exc_traceback;
25658  exc_info->exc_type = type;
25659  exc_info->exc_value = value;
25660  exc_info->exc_traceback = tb;
25661  #else
25662  tmp_type = tstate->exc_type;
25663  tmp_value = tstate->exc_value;
25664  tmp_tb = tstate->exc_traceback;
25665  tstate->exc_type = type;
25666  tstate->exc_value = value;
25667  tstate->exc_traceback = tb;
25668  #endif
25669  Py_XDECREF(tmp_type);
25670  Py_XDECREF(tmp_value);
25671  Py_XDECREF(tmp_tb);
25672 }
25673 #endif
25674 
25675 /* PyErrExceptionMatches */
25676  #if CYTHON_FAST_THREAD_STATE
25677 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
25678  Py_ssize_t i, n;
25679  n = PyTuple_GET_SIZE(tuple);
25680 #if PY_MAJOR_VERSION >= 3
25681  for (i=0; i<n; i++) {
25682  if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
25683  }
25684 #endif
25685  for (i=0; i<n; i++) {
25686  if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
25687  }
25688  return 0;
25689 }
25690 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
25691  PyObject *exc_type = tstate->curexc_type;
25692  if (exc_type == err) return 1;
25693  if (unlikely(!exc_type)) return 0;
25694  if (unlikely(PyTuple_Check(err)))
25695  return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
25696  return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
25697 }
25698 #endif
25699 
25700 /* GetException */
25701  #if CYTHON_FAST_THREAD_STATE
25702 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
25703 #else
25704 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
25705 #endif
25706 {
25707  PyObject *local_type, *local_value, *local_tb;
25708 #if CYTHON_FAST_THREAD_STATE
25709  PyObject *tmp_type, *tmp_value, *tmp_tb;
25710  local_type = tstate->curexc_type;
25711  local_value = tstate->curexc_value;
25712  local_tb = tstate->curexc_traceback;
25713  tstate->curexc_type = 0;
25714  tstate->curexc_value = 0;
25715  tstate->curexc_traceback = 0;
25716 #else
25717  PyErr_Fetch(&local_type, &local_value, &local_tb);
25718 #endif
25719  PyErr_NormalizeException(&local_type, &local_value, &local_tb);
25720 #if CYTHON_FAST_THREAD_STATE
25721  if (unlikely(tstate->curexc_type))
25722 #else
25723  if (unlikely(PyErr_Occurred()))
25724 #endif
25725  goto bad;
25726  #if PY_MAJOR_VERSION >= 3
25727  if (local_tb) {
25728  if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
25729  goto bad;
25730  }
25731  #endif
25732  Py_XINCREF(local_tb);
25733  Py_XINCREF(local_type);
25734  Py_XINCREF(local_value);
25735  *type = local_type;
25736  *value = local_value;
25737  *tb = local_tb;
25738 #if CYTHON_FAST_THREAD_STATE
25739  #if CYTHON_USE_EXC_INFO_STACK
25740  {
25741  _PyErr_StackItem *exc_info = tstate->exc_info;
25742  tmp_type = exc_info->exc_type;
25743  tmp_value = exc_info->exc_value;
25744  tmp_tb = exc_info->exc_traceback;
25745  exc_info->exc_type = local_type;
25746  exc_info->exc_value = local_value;
25747  exc_info->exc_traceback = local_tb;
25748  }
25749  #else
25750  tmp_type = tstate->exc_type;
25751  tmp_value = tstate->exc_value;
25752  tmp_tb = tstate->exc_traceback;
25753  tstate->exc_type = local_type;
25754  tstate->exc_value = local_value;
25755  tstate->exc_traceback = local_tb;
25756  #endif
25757  Py_XDECREF(tmp_type);
25758  Py_XDECREF(tmp_value);
25759  Py_XDECREF(tmp_tb);
25760 #else
25761  PyErr_SetExcInfo(local_type, local_value, local_tb);
25762 #endif
25763  return 0;
25764 bad:
25765  *type = 0;
25766  *value = 0;
25767  *tb = 0;
25768  Py_XDECREF(local_type);
25769  Py_XDECREF(local_value);
25770  Py_XDECREF(local_tb);
25771  return -1;
25772 }
25773 
25774 /* TypeImport */
25775  #ifndef __PYX_HAVE_RT_ImportType
25776 #define __PYX_HAVE_RT_ImportType
25777 static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
25778  size_t size, enum __Pyx_ImportType_CheckSize check_size)
25779 {
25780  PyObject *result = 0;
25781  char warning[200];
25782  Py_ssize_t basicsize;
25783 #ifdef Py_LIMITED_API
25784  PyObject *py_basicsize;
25785 #endif
25786  result = PyObject_GetAttrString(module, class_name);
25787  if (!result)
25788  goto bad;
25789  if (!PyType_Check(result)) {
25790  PyErr_Format(PyExc_TypeError,
25791  "%.200s.%.200s is not a type object",
25792  module_name, class_name);
25793  goto bad;
25794  }
25795 #ifndef Py_LIMITED_API
25796  basicsize = ((PyTypeObject *)result)->tp_basicsize;
25797 #else
25798  py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
25799  if (!py_basicsize)
25800  goto bad;
25801  basicsize = PyLong_AsSsize_t(py_basicsize);
25802  Py_DECREF(py_basicsize);
25803  py_basicsize = 0;
25804  if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
25805  goto bad;
25806 #endif
25807  if ((size_t)basicsize < size) {
25808  PyErr_Format(PyExc_ValueError,
25809  "%.200s.%.200s size changed, may indicate binary incompatibility. "
25810  "Expected %zd from C header, got %zd from PyObject",
25811  module_name, class_name, size, basicsize);
25812  goto bad;
25813  }
25814  if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
25815  PyErr_Format(PyExc_ValueError,
25816  "%.200s.%.200s size changed, may indicate binary incompatibility. "
25817  "Expected %zd from C header, got %zd from PyObject",
25818  module_name, class_name, size, basicsize);
25819  goto bad;
25820  }
25821  else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
25822  PyOS_snprintf(warning, sizeof(warning),
25823  "%s.%s size changed, may indicate binary incompatibility. "
25824  "Expected %zd from C header, got %zd from PyObject",
25825  module_name, class_name, size, basicsize);
25826  if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
25827  }
25828  return (PyTypeObject *)result;
25829 bad:
25830  Py_XDECREF(result);
25831  return NULL;
25832 }
25833 #endif
25834 
25835 /* Import */
25836  static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
25837  PyObject *empty_list = 0;
25838  PyObject *module = 0;
25839  PyObject *global_dict = 0;
25840  PyObject *empty_dict = 0;
25841  PyObject *list;
25842  #if PY_MAJOR_VERSION < 3
25843  PyObject *py_import;
25844  py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
25845  if (!py_import)
25846  goto bad;
25847  #endif
25848  if (from_list)
25849  list = from_list;
25850  else {
25851  empty_list = PyList_New(0);
25852  if (!empty_list)
25853  goto bad;
25854  list = empty_list;
25855  }
25856  global_dict = PyModule_GetDict(__pyx_m);
25857  if (!global_dict)
25858  goto bad;
25859  empty_dict = PyDict_New();
25860  if (!empty_dict)
25861  goto bad;
25862  {
25863  #if PY_MAJOR_VERSION >= 3
25864  if (level == -1) {
25865  if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
25866  module = PyImport_ImportModuleLevelObject(
25867  name, global_dict, empty_dict, list, 1);
25868  if (!module) {
25869  if (!PyErr_ExceptionMatches(PyExc_ImportError))
25870  goto bad;
25871  PyErr_Clear();
25872  }
25873  }
25874  level = 0;
25875  }
25876  #endif
25877  if (!module) {
25878  #if PY_MAJOR_VERSION < 3
25879  PyObject *py_level = PyInt_FromLong(level);
25880  if (!py_level)
25881  goto bad;
25882  module = PyObject_CallFunctionObjArgs(py_import,
25883  name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
25884  Py_DECREF(py_level);
25885  #else
25886  module = PyImport_ImportModuleLevelObject(
25887  name, global_dict, empty_dict, list, level);
25888  #endif
25889  }
25890  }
25891 bad:
25892  #if PY_MAJOR_VERSION < 3
25893  Py_XDECREF(py_import);
25894  #endif
25895  Py_XDECREF(empty_list);
25896  Py_XDECREF(empty_dict);
25897  return module;
25898 }
25899 
25900 /* CLineInTraceback */
25901  #ifndef CYTHON_CLINE_IN_TRACEBACK
25902 static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
25903  PyObject *use_cline;
25904  PyObject *ptype, *pvalue, *ptraceback;
25905 #if CYTHON_COMPILING_IN_CPYTHON
25906  PyObject **cython_runtime_dict;
25907 #endif
25908  if (unlikely(!__pyx_cython_runtime)) {
25909  return c_line;
25910  }
25911  __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
25912 #if CYTHON_COMPILING_IN_CPYTHON
25913  cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
25914  if (likely(cython_runtime_dict)) {
25915  __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
25916  use_cline, *cython_runtime_dict,
25917  __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
25918  } else
25919 #endif
25920  {
25921  PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
25922  if (use_cline_obj) {
25923  use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
25924  Py_DECREF(use_cline_obj);
25925  } else {
25926  PyErr_Clear();
25927  use_cline = NULL;
25928  }
25929  }
25930  if (!use_cline) {
25931  c_line = 0;
25932  PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
25933  }
25934  else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
25935  c_line = 0;
25936  }
25937  __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
25938  return c_line;
25939 }
25940 #endif
25941 
25942 /* CodeObjectCache */
25943  static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
25944  int start = 0, mid = 0, end = count - 1;
25945  if (end >= 0 && code_line > entries[end].code_line) {
25946  return count;
25947  }
25948  while (start < end) {
25949  mid = start + (end - start) / 2;
25950  if (code_line < entries[mid].code_line) {
25951  end = mid;
25952  } else if (code_line > entries[mid].code_line) {
25953  start = mid + 1;
25954  } else {
25955  return mid;
25956  }
25957  }
25958  if (code_line <= entries[mid].code_line) {
25959  return mid;
25960  } else {
25961  return mid + 1;
25962  }
25963 }
25964 static PyCodeObject *__pyx_find_code_object(int code_line) {
25965  PyCodeObject* code_object;
25966  int pos;
25967  if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
25968  return NULL;
25969  }
25970  pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
25971  if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
25972  return NULL;
25973  }
25974  code_object = __pyx_code_cache.entries[pos].code_object;
25975  Py_INCREF(code_object);
25976  return code_object;
25977 }
25978 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
25979  int pos, i;
25980  __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
25981  if (unlikely(!code_line)) {
25982  return;
25983  }
25984  if (unlikely(!entries)) {
25985  entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
25986  if (likely(entries)) {
25987  __pyx_code_cache.entries = entries;
25988  __pyx_code_cache.max_count = 64;
25989  __pyx_code_cache.count = 1;
25990  entries[0].code_line = code_line;
25991  entries[0].code_object = code_object;
25992  Py_INCREF(code_object);
25993  }
25994  return;
25995  }
25996  pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
25997  if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
25998  PyCodeObject* tmp = entries[pos].code_object;
25999  entries[pos].code_object = code_object;
26000  Py_DECREF(tmp);
26001  return;
26002  }
26003  if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
26004  int new_max = __pyx_code_cache.max_count + 64;
26005  entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
26006  __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
26007  if (unlikely(!entries)) {
26008  return;
26009  }
26010  __pyx_code_cache.entries = entries;
26011  __pyx_code_cache.max_count = new_max;
26012  }
26013  for (i=__pyx_code_cache.count; i>pos; i--) {
26014  entries[i] = entries[i-1];
26015  }
26016  entries[pos].code_line = code_line;
26017  entries[pos].code_object = code_object;
26018  __pyx_code_cache.count++;
26019  Py_INCREF(code_object);
26020 }
26021 
26022 /* AddTraceback */
26023  #include "compile.h"
26024 #include "frameobject.h"
26025 #include "traceback.h"
26026 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
26027  const char *funcname, int c_line,
26028  int py_line, const char *filename) {
26029  PyCodeObject *py_code = 0;
26030  PyObject *py_srcfile = 0;
26031  PyObject *py_funcname = 0;
26032  #if PY_MAJOR_VERSION < 3
26033  py_srcfile = PyString_FromString(filename);
26034  #else
26035  py_srcfile = PyUnicode_FromString(filename);
26036  #endif
26037  if (!py_srcfile) goto bad;
26038  if (c_line) {
26039  #if PY_MAJOR_VERSION < 3
26040  py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
26041  #else
26042  py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
26043  #endif
26044  }
26045  else {
26046  #if PY_MAJOR_VERSION < 3
26047  py_funcname = PyString_FromString(funcname);
26048  #else
26049  py_funcname = PyUnicode_FromString(funcname);
26050  #endif
26051  }
26052  if (!py_funcname) goto bad;
26053  py_code = __Pyx_PyCode_New(
26054  0,
26055  0,
26056  0,
26057  0,
26058  0,
26059  __pyx_empty_bytes, /*PyObject *code,*/
26060  __pyx_empty_tuple, /*PyObject *consts,*/
26061  __pyx_empty_tuple, /*PyObject *names,*/
26062  __pyx_empty_tuple, /*PyObject *varnames,*/
26063  __pyx_empty_tuple, /*PyObject *freevars,*/
26064  __pyx_empty_tuple, /*PyObject *cellvars,*/
26065  py_srcfile, /*PyObject *filename,*/
26066  py_funcname, /*PyObject *name,*/
26067  py_line,
26068  __pyx_empty_bytes /*PyObject *lnotab*/
26069  );
26070  Py_DECREF(py_srcfile);
26071  Py_DECREF(py_funcname);
26072  return py_code;
26073 bad:
26074  Py_XDECREF(py_srcfile);
26075  Py_XDECREF(py_funcname);
26076  return NULL;
26077 }
26078 static void __Pyx_AddTraceback(const char *funcname, int c_line,
26079  int py_line, const char *filename) {
26080  PyCodeObject *py_code = 0;
26081  PyFrameObject *py_frame = 0;
26082  PyThreadState *tstate = __Pyx_PyThreadState_Current;
26083  if (c_line) {
26084  c_line = __Pyx_CLineForTraceback(tstate, c_line);
26085  }
26086  py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
26087  if (!py_code) {
26088  py_code = __Pyx_CreateCodeObjectForTraceback(
26089  funcname, c_line, py_line, filename);
26090  if (!py_code) goto bad;
26091  __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
26092  }
26093  py_frame = PyFrame_New(
26094  tstate, /*PyThreadState *tstate,*/
26095  py_code, /*PyCodeObject *code,*/
26096  __pyx_d, /*PyObject *globals,*/
26097  0 /*PyObject *locals*/
26098  );
26099  if (!py_frame) goto bad;
26100  __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
26101  PyTraceBack_Here(py_frame);
26102 bad:
26103  Py_XDECREF(py_code);
26104  Py_XDECREF(py_frame);
26105 }
26106 
26107 #if PY_MAJOR_VERSION < 3
26108 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
26109  if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
26110  PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
26111  return -1;
26112 }
26113 static void __Pyx_ReleaseBuffer(Py_buffer *view) {
26114  PyObject *obj = view->obj;
26115  if (!obj) return;
26116  if (PyObject_CheckBuffer(obj)) {
26117  PyBuffer_Release(view);
26118  return;
26119  }
26120  if ((0)) {}
26121  view->obj = NULL;
26122  Py_DECREF(obj);
26123 }
26124 #endif
26125 
26126 
26127  /* CIntFromPyVerify */
26128  #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
26129  __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
26130 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
26131  __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
26132 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
26133  {\
26134  func_type value = func_value;\
26135  if (sizeof(target_type) < sizeof(func_type)) {\
26136  if (unlikely(value != (func_type) (target_type) value)) {\
26137  func_type zero = 0;\
26138  if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
26139  return (target_type) -1;\
26140  if (is_unsigned && unlikely(value < zero))\
26141  goto raise_neg_overflow;\
26142  else\
26143  goto raise_overflow;\
26144  }\
26145  }\
26146  return (target_type) value;\
26147  }
26148 
26149 /* CIntToPy */
26150  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
26151  const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
26152  const int is_unsigned = neg_one > const_zero;
26153  if (is_unsigned) {
26154  if (sizeof(int) < sizeof(long)) {
26155  return PyInt_FromLong((long) value);
26156  } else if (sizeof(int) <= sizeof(unsigned long)) {
26157  return PyLong_FromUnsignedLong((unsigned long) value);
26158 #ifdef HAVE_LONG_LONG
26159  } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
26160  return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
26161 #endif
26162  }
26163  } else {
26164  if (sizeof(int) <= sizeof(long)) {
26165  return PyInt_FromLong((long) value);
26166 #ifdef HAVE_LONG_LONG
26167  } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
26168  return PyLong_FromLongLong((PY_LONG_LONG) value);
26169 #endif
26170  }
26171  }
26172  {
26173  int one = 1; int little = (int)*(unsigned char *)&one;
26174  unsigned char *bytes = (unsigned char *)&value;
26175  return _PyLong_FromByteArray(bytes, sizeof(int),
26176  little, !is_unsigned);
26177  }
26178 }
26179 
26180 /* CIntToPy */
26181  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value) {
26182  const Py_intptr_t neg_one = (Py_intptr_t) ((Py_intptr_t) 0 - (Py_intptr_t) 1), const_zero = (Py_intptr_t) 0;
26183  const int is_unsigned = neg_one > const_zero;
26184  if (is_unsigned) {
26185  if (sizeof(Py_intptr_t) < sizeof(long)) {
26186  return PyInt_FromLong((long) value);
26187  } else if (sizeof(Py_intptr_t) <= sizeof(unsigned long)) {
26188  return PyLong_FromUnsignedLong((unsigned long) value);
26189 #ifdef HAVE_LONG_LONG
26190  } else if (sizeof(Py_intptr_t) <= sizeof(unsigned PY_LONG_LONG)) {
26191  return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
26192 #endif
26193  }
26194  } else {
26195  if (sizeof(Py_intptr_t) <= sizeof(long)) {
26196  return PyInt_FromLong((long) value);
26197 #ifdef HAVE_LONG_LONG
26198  } else if (sizeof(Py_intptr_t) <= sizeof(PY_LONG_LONG)) {
26199  return PyLong_FromLongLong((PY_LONG_LONG) value);
26200 #endif
26201  }
26202  }
26203  {
26204  int one = 1; int little = (int)*(unsigned char *)&one;
26205  unsigned char *bytes = (unsigned char *)&value;
26206  return _PyLong_FromByteArray(bytes, sizeof(Py_intptr_t),
26207  little, !is_unsigned);
26208  }
26209 }
26210 
26211 /* CIntToPy */
26212  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
26213  const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
26214  const int is_unsigned = neg_one > const_zero;
26215  if (is_unsigned) {
26216  if (sizeof(long) < sizeof(long)) {
26217  return PyInt_FromLong((long) value);
26218  } else if (sizeof(long) <= sizeof(unsigned long)) {
26219  return PyLong_FromUnsignedLong((unsigned long) value);
26220 #ifdef HAVE_LONG_LONG
26221  } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
26222  return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
26223 #endif
26224  }
26225  } else {
26226  if (sizeof(long) <= sizeof(long)) {
26227  return PyInt_FromLong((long) value);
26228 #ifdef HAVE_LONG_LONG
26229  } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
26230  return PyLong_FromLongLong((PY_LONG_LONG) value);
26231 #endif
26232  }
26233  }
26234  {
26235  int one = 1; int little = (int)*(unsigned char *)&one;
26236  unsigned char *bytes = (unsigned char *)&value;
26237  return _PyLong_FromByteArray(bytes, sizeof(long),
26238  little, !is_unsigned);
26239  }
26240 }
26241 
26242 /* Declarations */
26243  #if CYTHON_CCOMPLEX
26244  #ifdef __cplusplus
26245  static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
26246  return ::std::complex< float >(x, y);
26247  }
26248  #else
26249  static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
26250  return x + y*(__pyx_t_float_complex)_Complex_I;
26251  }
26252  #endif
26253 #else
26254  static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
26255  __pyx_t_float_complex z;
26256  z.real = x;
26257  z.imag = y;
26258  return z;
26259  }
26260 #endif
26261 
26262 /* Arithmetic */
26263  #if CYTHON_CCOMPLEX
26264 #else
26265  static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
26266  return (a.real == b.real) && (a.imag == b.imag);
26267  }
26268  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
26269  __pyx_t_float_complex z;
26270  z.real = a.real + b.real;
26271  z.imag = a.imag + b.imag;
26272  return z;
26273  }
26274  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
26275  __pyx_t_float_complex z;
26276  z.real = a.real - b.real;
26277  z.imag = a.imag - b.imag;
26278  return z;
26279  }
26280  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
26281  __pyx_t_float_complex z;
26282  z.real = a.real * b.real - a.imag * b.imag;
26283  z.imag = a.real * b.imag + a.imag * b.real;
26284  return z;
26285  }
26286  #if 1
26287  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
26288  if (b.imag == 0) {
26289  return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
26290  } else if (fabsf(b.real) >= fabsf(b.imag)) {
26291  if (b.real == 0 && b.imag == 0) {
26292  return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
26293  } else {
26294  float r = b.imag / b.real;
26295  float s = (float)(1.0) / (b.real + b.imag * r);
26296  return __pyx_t_float_complex_from_parts(
26297  (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
26298  }
26299  } else {
26300  float r = b.real / b.imag;
26301  float s = (float)(1.0) / (b.imag + b.real * r);
26302  return __pyx_t_float_complex_from_parts(
26303  (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
26304  }
26305  }
26306  #else
26307  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
26308  if (b.imag == 0) {
26309  return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
26310  } else {
26311  float denom = b.real * b.real + b.imag * b.imag;
26312  return __pyx_t_float_complex_from_parts(
26313  (a.real * b.real + a.imag * b.imag) / denom,
26314  (a.imag * b.real - a.real * b.imag) / denom);
26315  }
26316  }
26317  #endif
26318  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
26319  __pyx_t_float_complex z;
26320  z.real = -a.real;
26321  z.imag = -a.imag;
26322  return z;
26323  }
26324  static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
26325  return (a.real == 0) && (a.imag == 0);
26326  }
26327  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
26328  __pyx_t_float_complex z;
26329  z.real = a.real;
26330  z.imag = -a.imag;
26331  return z;
26332  }
26333  #if 1
26334  static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) {
26335  #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
26336  return sqrtf(z.real*z.real + z.imag*z.imag);
26337  #else
26338  return hypotf(z.real, z.imag);
26339  #endif
26340  }
26341  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
26342  __pyx_t_float_complex z;
26343  float r, lnr, theta, z_r, z_theta;
26344  if (b.imag == 0 && b.real == (int)b.real) {
26345  if (b.real < 0) {
26346  float denom = a.real * a.real + a.imag * a.imag;
26347  a.real = a.real / denom;
26348  a.imag = -a.imag / denom;
26349  b.real = -b.real;
26350  }
26351  switch ((int)b.real) {
26352  case 0:
26353  z.real = 1;
26354  z.imag = 0;
26355  return z;
26356  case 1:
26357  return a;
26358  case 2:
26359  return __Pyx_c_prod_float(a, a);
26360  case 3:
26361  z = __Pyx_c_prod_float(a, a);
26362  return __Pyx_c_prod_float(z, a);
26363  case 4:
26364  z = __Pyx_c_prod_float(a, a);
26365  return __Pyx_c_prod_float(z, z);
26366  }
26367  }
26368  if (a.imag == 0) {
26369  if (a.real == 0) {
26370  return a;
26371  } else if (b.imag == 0) {
26372  z.real = powf(a.real, b.real);
26373  z.imag = 0;
26374  return z;
26375  } else if (a.real > 0) {
26376  r = a.real;
26377  theta = 0;
26378  } else {
26379  r = -a.real;
26380  theta = atan2f(0.0, -1.0);
26381  }
26382  } else {
26383  r = __Pyx_c_abs_float(a);
26384  theta = atan2f(a.imag, a.real);
26385  }
26386  lnr = logf(r);
26387  z_r = expf(lnr * b.real - theta * b.imag);
26388  z_theta = theta * b.real + lnr * b.imag;
26389  z.real = z_r * cosf(z_theta);
26390  z.imag = z_r * sinf(z_theta);
26391  return z;
26392  }
26393  #endif
26394 #endif
26395 
26396 /* Declarations */
26397  #if CYTHON_CCOMPLEX
26398  #ifdef __cplusplus
26399  static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
26400  return ::std::complex< double >(x, y);
26401  }
26402  #else
26403  static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
26404  return x + y*(__pyx_t_double_complex)_Complex_I;
26405  }
26406  #endif
26407 #else
26408  static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
26409  __pyx_t_double_complex z;
26410  z.real = x;
26411  z.imag = y;
26412  return z;
26413  }
26414 #endif
26415 
26416 /* Arithmetic */
26417  #if CYTHON_CCOMPLEX
26418 #else
26419  static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
26420  return (a.real == b.real) && (a.imag == b.imag);
26421  }
26422  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
26423  __pyx_t_double_complex z;
26424  z.real = a.real + b.real;
26425  z.imag = a.imag + b.imag;
26426  return z;
26427  }
26428  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
26429  __pyx_t_double_complex z;
26430  z.real = a.real - b.real;
26431  z.imag = a.imag - b.imag;
26432  return z;
26433  }
26434  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
26435  __pyx_t_double_complex z;
26436  z.real = a.real * b.real - a.imag * b.imag;
26437  z.imag = a.real * b.imag + a.imag * b.real;
26438  return z;
26439  }
26440  #if 1
26441  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
26442  if (b.imag == 0) {
26443  return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
26444  } else if (fabs(b.real) >= fabs(b.imag)) {
26445  if (b.real == 0 && b.imag == 0) {
26446  return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
26447  } else {
26448  double r = b.imag / b.real;
26449  double s = (double)(1.0) / (b.real + b.imag * r);
26450  return __pyx_t_double_complex_from_parts(
26451  (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
26452  }
26453  } else {
26454  double r = b.real / b.imag;
26455  double s = (double)(1.0) / (b.imag + b.real * r);
26456  return __pyx_t_double_complex_from_parts(
26457  (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
26458  }
26459  }
26460  #else
26461  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
26462  if (b.imag == 0) {
26463  return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
26464  } else {
26465  double denom = b.real * b.real + b.imag * b.imag;
26466  return __pyx_t_double_complex_from_parts(
26467  (a.real * b.real + a.imag * b.imag) / denom,
26468  (a.imag * b.real - a.real * b.imag) / denom);
26469  }
26470  }
26471  #endif
26472  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
26473  __pyx_t_double_complex z;
26474  z.real = -a.real;
26475  z.imag = -a.imag;
26476  return z;
26477  }
26478  static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
26479  return (a.real == 0) && (a.imag == 0);
26480  }
26481  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
26482  __pyx_t_double_complex z;
26483  z.real = a.real;
26484  z.imag = -a.imag;
26485  return z;
26486  }
26487  #if 1
26488  static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) {
26489  #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
26490  return sqrt(z.real*z.real + z.imag*z.imag);
26491  #else
26492  return hypot(z.real, z.imag);
26493  #endif
26494  }
26495  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
26496  __pyx_t_double_complex z;
26497  double r, lnr, theta, z_r, z_theta;
26498  if (b.imag == 0 && b.real == (int)b.real) {
26499  if (b.real < 0) {
26500  double denom = a.real * a.real + a.imag * a.imag;
26501  a.real = a.real / denom;
26502  a.imag = -a.imag / denom;
26503  b.real = -b.real;
26504  }
26505  switch ((int)b.real) {
26506  case 0:
26507  z.real = 1;
26508  z.imag = 0;
26509  return z;
26510  case 1:
26511  return a;
26512  case 2:
26513  return __Pyx_c_prod_double(a, a);
26514  case 3:
26515  z = __Pyx_c_prod_double(a, a);
26516  return __Pyx_c_prod_double(z, a);
26517  case 4:
26518  z = __Pyx_c_prod_double(a, a);
26519  return __Pyx_c_prod_double(z, z);
26520  }
26521  }
26522  if (a.imag == 0) {
26523  if (a.real == 0) {
26524  return a;
26525  } else if (b.imag == 0) {
26526  z.real = pow(a.real, b.real);
26527  z.imag = 0;
26528  return z;
26529  } else if (a.real > 0) {
26530  r = a.real;
26531  theta = 0;
26532  } else {
26533  r = -a.real;
26534  theta = atan2(0.0, -1.0);
26535  }
26536  } else {
26537  r = __Pyx_c_abs_double(a);
26538  theta = atan2(a.imag, a.real);
26539  }
26540  lnr = log(r);
26541  z_r = exp(lnr * b.real - theta * b.imag);
26542  z_theta = theta * b.real + lnr * b.imag;
26543  z.real = z_r * cos(z_theta);
26544  z.imag = z_r * sin(z_theta);
26545  return z;
26546  }
26547  #endif
26548 #endif
26549 
26550 /* CIntToPy */
26551  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value) {
26552  const enum NPY_TYPES neg_one = (enum NPY_TYPES) ((enum NPY_TYPES) 0 - (enum NPY_TYPES) 1), const_zero = (enum NPY_TYPES) 0;
26553  const int is_unsigned = neg_one > const_zero;
26554  if (is_unsigned) {
26555  if (sizeof(enum NPY_TYPES) < sizeof(long)) {
26556  return PyInt_FromLong((long) value);
26557  } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned long)) {
26558  return PyLong_FromUnsignedLong((unsigned long) value);
26559 #ifdef HAVE_LONG_LONG
26560  } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned PY_LONG_LONG)) {
26561  return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
26562 #endif
26563  }
26564  } else {
26565  if (sizeof(enum NPY_TYPES) <= sizeof(long)) {
26566  return PyInt_FromLong((long) value);
26567 #ifdef HAVE_LONG_LONG
26568  } else if (sizeof(enum NPY_TYPES) <= sizeof(PY_LONG_LONG)) {
26569  return PyLong_FromLongLong((PY_LONG_LONG) value);
26570 #endif
26571  }
26572  }
26573  {
26574  int one = 1; int little = (int)*(unsigned char *)&one;
26575  unsigned char *bytes = (unsigned char *)&value;
26576  return _PyLong_FromByteArray(bytes, sizeof(enum NPY_TYPES),
26577  little, !is_unsigned);
26578  }
26579 }
26580 
26581 /* CIntFromPy */
26582  static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
26583  const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
26584  const int is_unsigned = neg_one > const_zero;
26585 #if PY_MAJOR_VERSION < 3
26586  if (likely(PyInt_Check(x))) {
26587  if (sizeof(int) < sizeof(long)) {
26588  __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
26589  } else {
26590  long val = PyInt_AS_LONG(x);
26591  if (is_unsigned && unlikely(val < 0)) {
26592  goto raise_neg_overflow;
26593  }
26594  return (int) val;
26595  }
26596  } else
26597 #endif
26598  if (likely(PyLong_Check(x))) {
26599  if (is_unsigned) {
26600 #if CYTHON_USE_PYLONG_INTERNALS
26601  const digit* digits = ((PyLongObject*)x)->ob_digit;
26602  switch (Py_SIZE(x)) {
26603  case 0: return (int) 0;
26604  case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
26605  case 2:
26606  if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
26607  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26608  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26609  } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
26610  return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
26611  }
26612  }
26613  break;
26614  case 3:
26615  if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
26616  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26617  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26618  } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
26619  return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
26620  }
26621  }
26622  break;
26623  case 4:
26624  if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
26625  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26626  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26627  } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
26628  return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
26629  }
26630  }
26631  break;
26632  }
26633 #endif
26634 #if CYTHON_COMPILING_IN_CPYTHON
26635  if (unlikely(Py_SIZE(x) < 0)) {
26636  goto raise_neg_overflow;
26637  }
26638 #else
26639  {
26640  int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
26641  if (unlikely(result < 0))
26642  return (int) -1;
26643  if (unlikely(result == 1))
26644  goto raise_neg_overflow;
26645  }
26646 #endif
26647  if (sizeof(int) <= sizeof(unsigned long)) {
26648  __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
26649 #ifdef HAVE_LONG_LONG
26650  } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
26651  __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
26652 #endif
26653  }
26654  } else {
26655 #if CYTHON_USE_PYLONG_INTERNALS
26656  const digit* digits = ((PyLongObject*)x)->ob_digit;
26657  switch (Py_SIZE(x)) {
26658  case 0: return (int) 0;
26659  case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
26660  case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
26661  case -2:
26662  if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
26663  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26664  __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26665  } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
26666  return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
26667  }
26668  }
26669  break;
26670  case 2:
26671  if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
26672  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26673  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26674  } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
26675  return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
26676  }
26677  }
26678  break;
26679  case -3:
26680  if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
26681  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26682  __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26683  } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
26684  return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
26685  }
26686  }
26687  break;
26688  case 3:
26689  if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
26690  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26691  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26692  } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
26693  return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
26694  }
26695  }
26696  break;
26697  case -4:
26698  if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
26699  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26700  __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26701  } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
26702  return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
26703  }
26704  }
26705  break;
26706  case 4:
26707  if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
26708  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26709  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26710  } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
26711  return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
26712  }
26713  }
26714  break;
26715  }
26716 #endif
26717  if (sizeof(int) <= sizeof(long)) {
26718  __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
26719 #ifdef HAVE_LONG_LONG
26720  } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
26721  __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
26722 #endif
26723  }
26724  }
26725  {
26726 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
26727  PyErr_SetString(PyExc_RuntimeError,
26728  "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
26729 #else
26730  int val;
26731  PyObject *v = __Pyx_PyNumber_IntOrLong(x);
26732  #if PY_MAJOR_VERSION < 3
26733  if (likely(v) && !PyLong_Check(v)) {
26734  PyObject *tmp = v;
26735  v = PyNumber_Long(tmp);
26736  Py_DECREF(tmp);
26737  }
26738  #endif
26739  if (likely(v)) {
26740  int one = 1; int is_little = (int)*(unsigned char *)&one;
26741  unsigned char *bytes = (unsigned char *)&val;
26742  int ret = _PyLong_AsByteArray((PyLongObject *)v,
26743  bytes, sizeof(val),
26744  is_little, !is_unsigned);
26745  Py_DECREF(v);
26746  if (likely(!ret))
26747  return val;
26748  }
26749 #endif
26750  return (int) -1;
26751  }
26752  } else {
26753  int val;
26754  PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
26755  if (!tmp) return (int) -1;
26756  val = __Pyx_PyInt_As_int(tmp);
26757  Py_DECREF(tmp);
26758  return val;
26759  }
26760 raise_overflow:
26761  PyErr_SetString(PyExc_OverflowError,
26762  "value too large to convert to int");
26763  return (int) -1;
26764 raise_neg_overflow:
26765  PyErr_SetString(PyExc_OverflowError,
26766  "can't convert negative value to int");
26767  return (int) -1;
26768 }
26769 
26770 /* CIntFromPy */
26771  static CYTHON_INLINE Py_intptr_t __Pyx_PyInt_As_Py_intptr_t(PyObject *x) {
26772  const Py_intptr_t neg_one = (Py_intptr_t) ((Py_intptr_t) 0 - (Py_intptr_t) 1), const_zero = (Py_intptr_t) 0;
26773  const int is_unsigned = neg_one > const_zero;
26774 #if PY_MAJOR_VERSION < 3
26775  if (likely(PyInt_Check(x))) {
26776  if (sizeof(Py_intptr_t) < sizeof(long)) {
26777  __PYX_VERIFY_RETURN_INT(Py_intptr_t, long, PyInt_AS_LONG(x))
26778  } else {
26779  long val = PyInt_AS_LONG(x);
26780  if (is_unsigned && unlikely(val < 0)) {
26781  goto raise_neg_overflow;
26782  }
26783  return (Py_intptr_t) val;
26784  }
26785  } else
26786 #endif
26787  if (likely(PyLong_Check(x))) {
26788  if (is_unsigned) {
26789 #if CYTHON_USE_PYLONG_INTERNALS
26790  const digit* digits = ((PyLongObject*)x)->ob_digit;
26791  switch (Py_SIZE(x)) {
26792  case 0: return (Py_intptr_t) 0;
26793  case 1: __PYX_VERIFY_RETURN_INT(Py_intptr_t, digit, digits[0])
26794  case 2:
26795  if (8 * sizeof(Py_intptr_t) > 1 * PyLong_SHIFT) {
26796  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26797  __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26798  } else if (8 * sizeof(Py_intptr_t) >= 2 * PyLong_SHIFT) {
26799  return (Py_intptr_t) (((((Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0]));
26800  }
26801  }
26802  break;
26803  case 3:
26804  if (8 * sizeof(Py_intptr_t) > 2 * PyLong_SHIFT) {
26805  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26806  __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26807  } else if (8 * sizeof(Py_intptr_t) >= 3 * PyLong_SHIFT) {
26808  return (Py_intptr_t) (((((((Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0]));
26809  }
26810  }
26811  break;
26812  case 4:
26813  if (8 * sizeof(Py_intptr_t) > 3 * PyLong_SHIFT) {
26814  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26815  __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26816  } else if (8 * sizeof(Py_intptr_t) >= 4 * PyLong_SHIFT) {
26817  return (Py_intptr_t) (((((((((Py_intptr_t)digits[3]) << PyLong_SHIFT) | (Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0]));
26818  }
26819  }
26820  break;
26821  }
26822 #endif
26823 #if CYTHON_COMPILING_IN_CPYTHON
26824  if (unlikely(Py_SIZE(x) < 0)) {
26825  goto raise_neg_overflow;
26826  }
26827 #else
26828  {
26829  int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
26830  if (unlikely(result < 0))
26831  return (Py_intptr_t) -1;
26832  if (unlikely(result == 1))
26833  goto raise_neg_overflow;
26834  }
26835 #endif
26836  if (sizeof(Py_intptr_t) <= sizeof(unsigned long)) {
26837  __PYX_VERIFY_RETURN_INT_EXC(Py_intptr_t, unsigned long, PyLong_AsUnsignedLong(x))
26838 #ifdef HAVE_LONG_LONG
26839  } else if (sizeof(Py_intptr_t) <= sizeof(unsigned PY_LONG_LONG)) {
26840  __PYX_VERIFY_RETURN_INT_EXC(Py_intptr_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
26841 #endif
26842  }
26843  } else {
26844 #if CYTHON_USE_PYLONG_INTERNALS
26845  const digit* digits = ((PyLongObject*)x)->ob_digit;
26846  switch (Py_SIZE(x)) {
26847  case 0: return (Py_intptr_t) 0;
26848  case -1: __PYX_VERIFY_RETURN_INT(Py_intptr_t, sdigit, (sdigit) (-(sdigit)digits[0]))
26849  case 1: __PYX_VERIFY_RETURN_INT(Py_intptr_t, digit, +digits[0])
26850  case -2:
26851  if (8 * sizeof(Py_intptr_t) - 1 > 1 * PyLong_SHIFT) {
26852  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26853  __PYX_VERIFY_RETURN_INT(Py_intptr_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26854  } else if (8 * sizeof(Py_intptr_t) - 1 > 2 * PyLong_SHIFT) {
26855  return (Py_intptr_t) (((Py_intptr_t)-1)*(((((Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
26856  }
26857  }
26858  break;
26859  case 2:
26860  if (8 * sizeof(Py_intptr_t) > 1 * PyLong_SHIFT) {
26861  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26862  __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26863  } else if (8 * sizeof(Py_intptr_t) - 1 > 2 * PyLong_SHIFT) {
26864  return (Py_intptr_t) ((((((Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
26865  }
26866  }
26867  break;
26868  case -3:
26869  if (8 * sizeof(Py_intptr_t) - 1 > 2 * PyLong_SHIFT) {
26870  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26871  __PYX_VERIFY_RETURN_INT(Py_intptr_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26872  } else if (8 * sizeof(Py_intptr_t) - 1 > 3 * PyLong_SHIFT) {
26873  return (Py_intptr_t) (((Py_intptr_t)-1)*(((((((Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
26874  }
26875  }
26876  break;
26877  case 3:
26878  if (8 * sizeof(Py_intptr_t) > 2 * PyLong_SHIFT) {
26879  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26880  __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26881  } else if (8 * sizeof(Py_intptr_t) - 1 > 3 * PyLong_SHIFT) {
26882  return (Py_intptr_t) ((((((((Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
26883  }
26884  }
26885  break;
26886  case -4:
26887  if (8 * sizeof(Py_intptr_t) - 1 > 3 * PyLong_SHIFT) {
26888  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26889  __PYX_VERIFY_RETURN_INT(Py_intptr_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26890  } else if (8 * sizeof(Py_intptr_t) - 1 > 4 * PyLong_SHIFT) {
26891  return (Py_intptr_t) (((Py_intptr_t)-1)*(((((((((Py_intptr_t)digits[3]) << PyLong_SHIFT) | (Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
26892  }
26893  }
26894  break;
26895  case 4:
26896  if (8 * sizeof(Py_intptr_t) > 3 * PyLong_SHIFT) {
26897  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
26898  __PYX_VERIFY_RETURN_INT(Py_intptr_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26899  } else if (8 * sizeof(Py_intptr_t) - 1 > 4 * PyLong_SHIFT) {
26900  return (Py_intptr_t) ((((((((((Py_intptr_t)digits[3]) << PyLong_SHIFT) | (Py_intptr_t)digits[2]) << PyLong_SHIFT) | (Py_intptr_t)digits[1]) << PyLong_SHIFT) | (Py_intptr_t)digits[0])));
26901  }
26902  }
26903  break;
26904  }
26905 #endif
26906  if (sizeof(Py_intptr_t) <= sizeof(long)) {
26907  __PYX_VERIFY_RETURN_INT_EXC(Py_intptr_t, long, PyLong_AsLong(x))
26908 #ifdef HAVE_LONG_LONG
26909  } else if (sizeof(Py_intptr_t) <= sizeof(PY_LONG_LONG)) {
26910  __PYX_VERIFY_RETURN_INT_EXC(Py_intptr_t, PY_LONG_LONG, PyLong_AsLongLong(x))
26911 #endif
26912  }
26913  }
26914  {
26915 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
26916  PyErr_SetString(PyExc_RuntimeError,
26917  "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
26918 #else
26919  Py_intptr_t val;
26920  PyObject *v = __Pyx_PyNumber_IntOrLong(x);
26921  #if PY_MAJOR_VERSION < 3
26922  if (likely(v) && !PyLong_Check(v)) {
26923  PyObject *tmp = v;
26924  v = PyNumber_Long(tmp);
26925  Py_DECREF(tmp);
26926  }
26927  #endif
26928  if (likely(v)) {
26929  int one = 1; int is_little = (int)*(unsigned char *)&one;
26930  unsigned char *bytes = (unsigned char *)&val;
26931  int ret = _PyLong_AsByteArray((PyLongObject *)v,
26932  bytes, sizeof(val),
26933  is_little, !is_unsigned);
26934  Py_DECREF(v);
26935  if (likely(!ret))
26936  return val;
26937  }
26938 #endif
26939  return (Py_intptr_t) -1;
26940  }
26941  } else {
26942  Py_intptr_t val;
26943  PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
26944  if (!tmp) return (Py_intptr_t) -1;
26945  val = __Pyx_PyInt_As_Py_intptr_t(tmp);
26946  Py_DECREF(tmp);
26947  return val;
26948  }
26949 raise_overflow:
26950  PyErr_SetString(PyExc_OverflowError,
26951  "value too large to convert to Py_intptr_t");
26952  return (Py_intptr_t) -1;
26953 raise_neg_overflow:
26954  PyErr_SetString(PyExc_OverflowError,
26955  "can't convert negative value to Py_intptr_t");
26956  return (Py_intptr_t) -1;
26957 }
26958 
26959 /* CIntFromPy */
26960  static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
26961  const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
26962  const int is_unsigned = neg_one > const_zero;
26963 #if PY_MAJOR_VERSION < 3
26964  if (likely(PyInt_Check(x))) {
26965  if (sizeof(long) < sizeof(long)) {
26966  __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
26967  } else {
26968  long val = PyInt_AS_LONG(x);
26969  if (is_unsigned && unlikely(val < 0)) {
26970  goto raise_neg_overflow;
26971  }
26972  return (long) val;
26973  }
26974  } else
26975 #endif
26976  if (likely(PyLong_Check(x))) {
26977  if (is_unsigned) {
26978 #if CYTHON_USE_PYLONG_INTERNALS
26979  const digit* digits = ((PyLongObject*)x)->ob_digit;
26980  switch (Py_SIZE(x)) {
26981  case 0: return (long) 0;
26982  case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
26983  case 2:
26984  if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
26985  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
26986  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26987  } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
26988  return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
26989  }
26990  }
26991  break;
26992  case 3:
26993  if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
26994  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
26995  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
26996  } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
26997  return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
26998  }
26999  }
27000  break;
27001  case 4:
27002  if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
27003  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
27004  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27005  } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
27006  return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
27007  }
27008  }
27009  break;
27010  }
27011 #endif
27012 #if CYTHON_COMPILING_IN_CPYTHON
27013  if (unlikely(Py_SIZE(x) < 0)) {
27014  goto raise_neg_overflow;
27015  }
27016 #else
27017  {
27018  int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
27019  if (unlikely(result < 0))
27020  return (long) -1;
27021  if (unlikely(result == 1))
27022  goto raise_neg_overflow;
27023  }
27024 #endif
27025  if (sizeof(long) <= sizeof(unsigned long)) {
27026  __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
27027 #ifdef HAVE_LONG_LONG
27028  } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
27029  __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
27030 #endif
27031  }
27032  } else {
27033 #if CYTHON_USE_PYLONG_INTERNALS
27034  const digit* digits = ((PyLongObject*)x)->ob_digit;
27035  switch (Py_SIZE(x)) {
27036  case 0: return (long) 0;
27037  case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
27038  case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
27039  case -2:
27040  if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
27041  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
27042  __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27043  } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
27044  return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
27045  }
27046  }
27047  break;
27048  case 2:
27049  if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
27050  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
27051  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27052  } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
27053  return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
27054  }
27055  }
27056  break;
27057  case -3:
27058  if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
27059  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
27060  __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27061  } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
27062  return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
27063  }
27064  }
27065  break;
27066  case 3:
27067  if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
27068  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
27069  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27070  } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
27071  return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
27072  }
27073  }
27074  break;
27075  case -4:
27076  if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
27077  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
27078  __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27079  } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
27080  return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
27081  }
27082  }
27083  break;
27084  case 4:
27085  if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
27086  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
27087  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27088  } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
27089  return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
27090  }
27091  }
27092  break;
27093  }
27094 #endif
27095  if (sizeof(long) <= sizeof(long)) {
27096  __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
27097 #ifdef HAVE_LONG_LONG
27098  } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
27099  __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
27100 #endif
27101  }
27102  }
27103  {
27104 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
27105  PyErr_SetString(PyExc_RuntimeError,
27106  "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
27107 #else
27108  long val;
27109  PyObject *v = __Pyx_PyNumber_IntOrLong(x);
27110  #if PY_MAJOR_VERSION < 3
27111  if (likely(v) && !PyLong_Check(v)) {
27112  PyObject *tmp = v;
27113  v = PyNumber_Long(tmp);
27114  Py_DECREF(tmp);
27115  }
27116  #endif
27117  if (likely(v)) {
27118  int one = 1; int is_little = (int)*(unsigned char *)&one;
27119  unsigned char *bytes = (unsigned char *)&val;
27120  int ret = _PyLong_AsByteArray((PyLongObject *)v,
27121  bytes, sizeof(val),
27122  is_little, !is_unsigned);
27123  Py_DECREF(v);
27124  if (likely(!ret))
27125  return val;
27126  }
27127 #endif
27128  return (long) -1;
27129  }
27130  } else {
27131  long val;
27132  PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
27133  if (!tmp) return (long) -1;
27134  val = __Pyx_PyInt_As_long(tmp);
27135  Py_DECREF(tmp);
27136  return val;
27137  }
27138 raise_overflow:
27139  PyErr_SetString(PyExc_OverflowError,
27140  "value too large to convert to long");
27141  return (long) -1;
27142 raise_neg_overflow:
27143  PyErr_SetString(PyExc_OverflowError,
27144  "can't convert negative value to long");
27145  return (long) -1;
27146 }
27147 
27148 /* FastTypeChecks */
27149  #if CYTHON_COMPILING_IN_CPYTHON
27150 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
27151  while (a) {
27152  a = a->tp_base;
27153  if (a == b)
27154  return 1;
27155  }
27156  return b == &PyBaseObject_Type;
27157 }
27158 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
27159  PyObject *mro;
27160  if (a == b) return 1;
27161  mro = a->tp_mro;
27162  if (likely(mro)) {
27163  Py_ssize_t i, n;
27164  n = PyTuple_GET_SIZE(mro);
27165  for (i = 0; i < n; i++) {
27166  if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
27167  return 1;
27168  }
27169  return 0;
27170  }
27171  return __Pyx_InBases(a, b);
27172 }
27173 #if PY_MAJOR_VERSION == 2
27174 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
27175  PyObject *exception, *value, *tb;
27176  int res;
27177  __Pyx_PyThreadState_declare
27178  __Pyx_PyThreadState_assign
27179  __Pyx_ErrFetch(&exception, &value, &tb);
27180  res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
27181  if (unlikely(res == -1)) {
27182  PyErr_WriteUnraisable(err);
27183  res = 0;
27184  }
27185  if (!res) {
27186  res = PyObject_IsSubclass(err, exc_type2);
27187  if (unlikely(res == -1)) {
27188  PyErr_WriteUnraisable(err);
27189  res = 0;
27190  }
27191  }
27192  __Pyx_ErrRestore(exception, value, tb);
27193  return res;
27194 }
27195 #else
27196 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
27197  int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
27198  if (!res) {
27199  res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
27200  }
27201  return res;
27202 }
27203 #endif
27204 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
27205  Py_ssize_t i, n;
27206  assert(PyExceptionClass_Check(exc_type));
27207  n = PyTuple_GET_SIZE(tuple);
27208 #if PY_MAJOR_VERSION >= 3
27209  for (i=0; i<n; i++) {
27210  if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
27211  }
27212 #endif
27213  for (i=0; i<n; i++) {
27214  PyObject *t = PyTuple_GET_ITEM(tuple, i);
27215  #if PY_MAJOR_VERSION < 3
27216  if (likely(exc_type == t)) return 1;
27217  #endif
27218  if (likely(PyExceptionClass_Check(t))) {
27219  if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
27220  } else {
27221  }
27222  }
27223  return 0;
27224 }
27225 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
27226  if (likely(err == exc_type)) return 1;
27227  if (likely(PyExceptionClass_Check(err))) {
27228  if (likely(PyExceptionClass_Check(exc_type))) {
27229  return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
27230  } else if (likely(PyTuple_Check(exc_type))) {
27231  return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
27232  } else {
27233  }
27234  }
27235  return PyErr_GivenExceptionMatches(err, exc_type);
27236 }
27237 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
27238  assert(PyExceptionClass_Check(exc_type1));
27239  assert(PyExceptionClass_Check(exc_type2));
27240  if (likely(err == exc_type1 || err == exc_type2)) return 1;
27241  if (likely(PyExceptionClass_Check(err))) {
27242  return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
27243  }
27244  return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
27245 }
27246 #endif
27247 
27248 /* CheckBinaryVersion */
27249  static int __Pyx_check_binary_version(void) {
27250  char ctversion[4], rtversion[4];
27251  PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
27252  PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
27253  if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
27254  char message[200];
27255  PyOS_snprintf(message, sizeof(message),
27256  "compiletime version %s of module '%.100s' "
27257  "does not match runtime version %s",
27258  ctversion, __Pyx_MODULE_NAME, rtversion);
27259  return PyErr_WarnEx(NULL, message, 1);
27260  }
27261  return 0;
27262 }
27263 
27264 /* InitStrings */
27265  static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
27266  while (t->p) {
27267  #if PY_MAJOR_VERSION < 3
27268  if (t->is_unicode) {
27269  *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
27270  } else if (t->intern) {
27271  *t->p = PyString_InternFromString(t->s);
27272  } else {
27273  *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
27274  }
27275  #else
27276  if (t->is_unicode | t->is_str) {
27277  if (t->intern) {
27278  *t->p = PyUnicode_InternFromString(t->s);
27279  } else if (t->encoding) {
27280  *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
27281  } else {
27282  *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
27283  }
27284  } else {
27285  *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
27286  }
27287  #endif
27288  if (!*t->p)
27289  return -1;
27290  if (PyObject_Hash(*t->p) == -1)
27291  return -1;
27292  ++t;
27293  }
27294  return 0;
27295 }
27296 
27297 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
27298  return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
27299 }
27300 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
27301  Py_ssize_t ignore;
27302  return __Pyx_PyObject_AsStringAndSize(o, &ignore);
27303 }
27304 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
27305 #if !CYTHON_PEP393_ENABLED
27306 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
27307  char* defenc_c;
27308  PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
27309  if (!defenc) return NULL;
27310  defenc_c = PyBytes_AS_STRING(defenc);
27311 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
27312  {
27313  char* end = defenc_c + PyBytes_GET_SIZE(defenc);
27314  char* c;
27315  for (c = defenc_c; c < end; c++) {
27316  if ((unsigned char) (*c) >= 128) {
27317  PyUnicode_AsASCIIString(o);
27318  return NULL;
27319  }
27320  }
27321  }
27322 #endif
27323  *length = PyBytes_GET_SIZE(defenc);
27324  return defenc_c;
27325 }
27326 #else
27327 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
27328  if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
27329 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
27330  if (likely(PyUnicode_IS_ASCII(o))) {
27331  *length = PyUnicode_GET_LENGTH(o);
27332  return PyUnicode_AsUTF8(o);
27333  } else {
27334  PyUnicode_AsASCIIString(o);
27335  return NULL;
27336  }
27337 #else
27338  return PyUnicode_AsUTF8AndSize(o, length);
27339 #endif
27340 }
27341 #endif
27342 #endif
27343 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
27344 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
27345  if (
27346 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
27347  __Pyx_sys_getdefaultencoding_not_ascii &&
27348 #endif
27349  PyUnicode_Check(o)) {
27350  return __Pyx_PyUnicode_AsStringAndSize(o, length);
27351  } else
27352 #endif
27353 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
27354  if (PyByteArray_Check(o)) {
27355  *length = PyByteArray_GET_SIZE(o);
27356  return PyByteArray_AS_STRING(o);
27357  } else
27358 #endif
27359  {
27360  char* result;
27361  int r = PyBytes_AsStringAndSize(o, &result, length);
27362  if (unlikely(r < 0)) {
27363  return NULL;
27364  } else {
27365  return result;
27366  }
27367  }
27368 }
27369 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
27370  int is_true = x == Py_True;
27371  if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
27372  else return PyObject_IsTrue(x);
27373 }
27374 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
27375  int retval;
27376  if (unlikely(!x)) return -1;
27377  retval = __Pyx_PyObject_IsTrue(x);
27378  Py_DECREF(x);
27379  return retval;
27380 }
27381 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
27382 #if PY_MAJOR_VERSION >= 3
27383  if (PyLong_Check(result)) {
27384  if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
27385  "__int__ returned non-int (type %.200s). "
27386  "The ability to return an instance of a strict subclass of int "
27387  "is deprecated, and may be removed in a future version of Python.",
27388  Py_TYPE(result)->tp_name)) {
27389  Py_DECREF(result);
27390  return NULL;
27391  }
27392  return result;
27393  }
27394 #endif
27395  PyErr_Format(PyExc_TypeError,
27396  "__%.4s__ returned non-%.4s (type %.200s)",
27397  type_name, type_name, Py_TYPE(result)->tp_name);
27398  Py_DECREF(result);
27399  return NULL;
27400 }
27401 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
27402 #if CYTHON_USE_TYPE_SLOTS
27403  PyNumberMethods *m;
27404 #endif
27405  const char *name = NULL;
27406  PyObject *res = NULL;
27407 #if PY_MAJOR_VERSION < 3
27408  if (likely(PyInt_Check(x) || PyLong_Check(x)))
27409 #else
27410  if (likely(PyLong_Check(x)))
27411 #endif
27412  return __Pyx_NewRef(x);
27413 #if CYTHON_USE_TYPE_SLOTS
27414  m = Py_TYPE(x)->tp_as_number;
27415  #if PY_MAJOR_VERSION < 3
27416  if (m && m->nb_int) {
27417  name = "int";
27418  res = m->nb_int(x);
27419  }
27420  else if (m && m->nb_long) {
27421  name = "long";
27422  res = m->nb_long(x);
27423  }
27424  #else
27425  if (likely(m && m->nb_int)) {
27426  name = "int";
27427  res = m->nb_int(x);
27428  }
27429  #endif
27430 #else
27431  if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
27432  res = PyNumber_Int(x);
27433  }
27434 #endif
27435  if (likely(res)) {
27436 #if PY_MAJOR_VERSION < 3
27437  if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
27438 #else
27439  if (unlikely(!PyLong_CheckExact(res))) {
27440 #endif
27441  return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
27442  }
27443  }
27444  else if (!PyErr_Occurred()) {
27445  PyErr_SetString(PyExc_TypeError,
27446  "an integer is required");
27447  }
27448  return res;
27449 }
27450 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
27451  Py_ssize_t ival;
27452  PyObject *x;
27453 #if PY_MAJOR_VERSION < 3
27454  if (likely(PyInt_CheckExact(b))) {
27455  if (sizeof(Py_ssize_t) >= sizeof(long))
27456  return PyInt_AS_LONG(b);
27457  else
27458  return PyInt_AsSsize_t(b);
27459  }
27460 #endif
27461  if (likely(PyLong_CheckExact(b))) {
27462  #if CYTHON_USE_PYLONG_INTERNALS
27463  const digit* digits = ((PyLongObject*)b)->ob_digit;
27464  const Py_ssize_t size = Py_SIZE(b);
27465  if (likely(__Pyx_sst_abs(size) <= 1)) {
27466  ival = likely(size) ? digits[0] : 0;
27467  if (size == -1) ival = -ival;
27468  return ival;
27469  } else {
27470  switch (size) {
27471  case 2:
27472  if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
27473  return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
27474  }
27475  break;
27476  case -2:
27477  if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
27478  return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
27479  }
27480  break;
27481  case 3:
27482  if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
27483  return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
27484  }
27485  break;
27486  case -3:
27487  if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
27488  return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
27489  }
27490  break;
27491  case 4:
27492  if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
27493  return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
27494  }
27495  break;
27496  case -4:
27497  if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
27498  return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
27499  }
27500  break;
27501  }
27502  }
27503  #endif
27504  return PyLong_AsSsize_t(b);
27505  }
27506  x = PyNumber_Index(b);
27507  if (!x) return -1;
27508  ival = PyInt_AsSsize_t(x);
27509  Py_DECREF(x);
27510  return ival;
27511 }
27512 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
27513  return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
27514 }
27515 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
27516  return PyInt_FromSize_t(ival);
27517 }
27518 
27519 
27520 #endif /* Py_PYTHON_H */
f
Double f
Definition: Headers.h:64
number
Int number
Definition: Headers.h:33
s
Double s
Definition: Headers.h:84
n
Int n
Definition: Headers.h:28
v
Double v
Definition: Headers.h:95
T
Double T
Definition: Headers.h:87
z
Double * z
Definition: Headers.h:49
u
Double u
Definition: Headers.h:89
c
Double c
Definition: Headers.h:54
r
Double r
Definition: Headers.h:83
pos
double pos(double a)
Definition: testFMMandFSW.cpp:8